Thursday, February 25, 2016

[C++] defult defined functions by compiler

When you defined a class with nothing in it, the compiler will defined which function(s) for you ? 

class A{ }

1 constructor with non parameter A();
2 copy constructor : A(const A & a);
3 destructor ~A();
4 copy assignment : A& operator = (const A & a);

How to avoid the compiler defining these functions ?

 Override them

And how to avoid to use them ? 

override them as private

And how to avoid to use them in the class?

declare them but do not to define them

No comments:

Post a Comment