An empty class isnt really empty.
A compilergenerates definition for these functions automatically.
Default constructor if u don't have a constructor
Copy constructor
Copy assignemtn
Destructor
Class Empty {
Public:
Empty() {}
Empty( const Empty& rhs) { }
~Empty() { }
Empty& operator=(const Empty& rhs) { }
};
These are generated only if needed, but are esily needed for .e.g
Empty e1
Empty e2(e1)
E2 = e1
Causes generation of all of them
What does it mean : compilers reject implicit copy assignment operators in derived classess that inherit from base classes declaring the copy assignment operator private. ?
Things to remember:
Compilers may implicitly generate a class's default constructor , copy constructor , copy assignment operator and destructor
--
Regards,
Umesh Kumar
http://worthyarticles.blogspot.com/
No comments:
Post a Comment