Export (0) Print
Expand All
Expand Minimize

Compiler Warning (level 4) C4625

'derived class' : copy constructor could not be generated because a base class copy constructor is inaccessible

A copy constructor was not accessible in a base class and was therefore not generated for a derived class. Any attempt to copy an object of this type will cause a compiler error.

This warning is off by default. See Compiler Warnings That Are Off by Default for more information.

The following sample generates C4625:

// C4625.cpp
// compile with: /W4
#pragma warning(default : 4625)
struct A
{
   A() {}
private:
   A(const A&) {}

};

struct B
{
   A a;
}; // C4625, no copy constructor

/*
B Func()
{
   B b;
   return b;
}
*/

int main()
{
}
Show:
© 2014 Microsoft