CompuServe Messages

#operator= and MFC

    08-Jul-94 01:49:41
Sb: #operator= and MFC
Fm: Brad Baker 100032,2611
To: All
In the interest of good C++ practice I am coding my classes with copy contructors and where appropriate overloaded assignment (operator=) functions. Now I come accross the MFC defined classes (from which I inherit) and I find that they dont in fact define copy contructors or even assingment functions. So for example you cant do… CObArray a; CObArray b; b = a; Also in my assignment contructors I want to assign the inherited parts of the object, ususally like this.. class MyClass : CObject { … } MyClass& MyClass:operator=(MyClass& rhs) { CObject::=operator=(rhs); … return this*; } Have I got this all wrong (and in this case can you tell me why) or is the MFC not a good example of C++ practices?? Brad Baker Sterling Software Sydney, Australia