From: "Ilya P. Ryzhenkov" Organization: ISPh SB RAS To: djgpp AT delorie DOT com Date: Wed, 23 Oct 1996 14:59:31 GMT+0600 Subject: Re: Laugh at my mistakes (Errors you wish you're mother tol Message-ID: <11F7A236E18@spy.isp.nsc.ru> RI> Just for starters. Welcome to 'C'. Have fun! Where is welcome to 'C++' ? ;-) An example when, virtual functions doesn't work : class Dummy { protected : int SomeData; void Copy(Dummy *p) { memcpy(this,p,sizeof(Dummy)); } public : Dummy() {}; Dummy(Dummy *p) { Copy(p); }; // copy constructor virtual f() { printf("This is dummy!\n"); }; } class Dummy2 : public Dummy { public : Dummy2() {}; Dummy2(Dummy *p) { Copy(p); }; //copy constructor virtual f() { printf("This is dummy2!\n"); }; }; void main() { Dummy *p1=new Dummy(); p1->f(); // prints "This is dummy!" Dummy *p2=new Dummy2(p1); p2->f(); // also prints "This is dummy!" }; Have fun with C++ too ! ;)) ====================================================================== Institute of Semiconductors Physics Ilya P. Ryzhenkov Russian Academy of Sciencies e-mail: ilya AT spy DOT isp DOT nsc DOT ru Siberian Branch http://spy.isp.nsc.ru