TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: PIERRE PHANEUF
from: BALOG PAL
date: 1997-04-20 22:23:00
subject: Rating of C++

                             Hi, Pierre Phaneuf!
On 16 Apr 97  05:28:41 you wrote to Jerry Coffin
 PP> TThisObject = object(TObject)
 PP> constructor Init;
 PP> constructor Load(S: TStream);
 PP> procedure Store(S: TStream);
 PP> [...]
 PP> destructor Done;
 PP> end;
You do the same in C++, just ctors and dtors have fixed names:
struct TThisObject : public TObject {
        TThisObject();                  // Init
        TThisObject(TStream & s);       // Load form stream
        void Store(TStream & s);        // Store on stream
        ~TThisObject();                 // Done
};
Use:
{
TStream fIn;
TThisObject a;                  // calls Init
TThisObject loadedA(fIn) ;      // calls Load
TThisObject * pA  = new TThisObject;            // calls Init
TThisObject * pLa = new TThisObject(fIn);       // calls Load
delete pA;      // Done both
delete pLa;
}  // exitind scope, loadedA, a, fIn Done called
Paul
... Half a loaf is better than no rest at all.
--- OS/2 Warp
---------------
* Origin: The FlintStones' Cave in BedRock (2:371/20)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.