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)
|