Category : Files from Magazines
Archive   : NOV92_1.ZIP
Filename : CPPCLASS.ASC

 
Output of file : CPPCLASS.ASC contained in archive : NOV92_1.ZIP
_DESIGNING C++ CLASSES_
by Steven Sinofsky

[EXAMPLE 1]


[EXAMPLE 1]

class CBase {
public:
CBase(); // user-supplied constructor
~CBase(); // user-supplied destructor

// other functions and variables
};
class CMyClass : public CBase {
public:
CMyClass(); // user-supplied constructor
~CMyClass(); // user-supplied destructor
// other functions and variables
};
void main() {
CBase* pBase = new CMyClass;
delete pBase;
// wrong destructor invoked because ~CBase() is not virtual
}


[EXAMPLE 2]


/* 1 */ extern CMyClass m0;
/* 2 */ CMyClass m1; // invokes default constructor
/* 3 */ m1 = m0; // invokes assignment operator
/* 4 */ CMyClass mInit = m0; // invokes copy constructor


[EXAMPLE 3]

class CAnyClass : public CObject {
CAnyClass();
virtual ~CAnyClass();
CAnyClass(const CAnyClass& src);
CAnyClass& operator=(const CAnyClass& src);
};





  3 Responses to “Category : Files from Magazines
Archive   : NOV92_1.ZIP
Filename : CPPCLASS.ASC

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/