I just downloaded chrome source code and saw the following macros
// A macro to disallow the copy constructor and operator= functions
// This should be used in the private: declarations for a class
#define DISALLOW_COPY_A ND_ASSIGN(TypeN ame) \
TypeName(const TypeName&); \
void operator=(const TypeName&)
// An older, deprecated, politically incorrect name for the above.
#define DISALLOW_EVIL_C ONSTRUCTORS(Typ eName) DISALLOW_COPY_A ND_ASSIGN(TypeN ame)
DISALLOW_EVIL_C ONSTRUCTORS is used in all the classes in private section .
I know it is trying to disallow default copy and assignment constructors.
But can anyone tell me why they are treated as evil ?
I have searched in google and i see some people really hate constructors
to as much as to say real object oriented languages dont have constructors .
Can someone can explain this ?
Thanks a lot for your help !!
// A macro to disallow the copy constructor and operator= functions
// This should be used in the private: declarations for a class
#define DISALLOW_COPY_A ND_ASSIGN(TypeN ame) \
TypeName(const TypeName&); \
void operator=(const TypeName&)
// An older, deprecated, politically incorrect name for the above.
#define DISALLOW_EVIL_C ONSTRUCTORS(Typ eName) DISALLOW_COPY_A ND_ASSIGN(TypeN ame)
DISALLOW_EVIL_C ONSTRUCTORS is used in all the classes in private section .
I know it is trying to disallow default copy and assignment constructors.
But can anyone tell me why they are treated as evil ?
I have searched in google and i see some people really hate constructors
to as much as to say real object oriented languages dont have constructors .
Can someone can explain this ?
Thanks a lot for your help !!
Comment