
11 Feb
2004
11 Feb
'04
7:54 p.m.
One other thing that makes writing base class and derived classes easier is to add this to the ref struct class X { .... private: struct ref { ref (X *rhs) : p (rhs) {} template<class T> // new ref (T *rhs) : p(rhs) {} // compiles if T is derived from X. X *p; }; ..... }; Then in the derived class you can call: class Y : public X { .... Y(ref rhs) : X (rhs.p) // no cast needed to call X::ref , id(++cnt) , owner(true) { .... } .... }; Anyway the more I play with this the better I like it. Yours, -Gary-