Are the default copy constructors and assignment operator created for an abstract class in C++?

77 Views Asked by At

There is a default copy-constructor/ assignment operator which does a shallow copy. Are these created by default even for an abstract class?

1

There are 1 best solutions below

0
Remy Lebeau On

A class being abstract (ie, having pure virtual methods) doesn't change anything in regards to what the compiler may auto-generate for that class. All it does is require the class to not be instantiated directly, and that its pure virtual methods must be overridden in derived classes. That's it. Abstract base classes must still be able to be initialized/assigned to, like any other class.