TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Wim Veldhuis
from: Neil Spring
date: 1994-07-27 17:22:44
subject: general programming question: how to?

First, THANKS A LOT!!! I've been trying to find a book, or anything that
would say this is how you do it, instead of just blabbing about
polymorphism and how great object oriented stuff is. :)
 
Just one question... it looks like it might be an oversight in your code
ormy lack of understanding of virtual functions...
 
  wv> class Struct1 : public DataStruct { 
  wv>   // define data members here public: 
  wv>   Struct1( FILE *f, int Key ); 
  wv>   virtual ~Struct1(); 
  wv>   virtual void Process(); 
  wv>   virtual void Edit(); 
  wv>   virtual void Save(); } 
  wv> 
  wv> class Struct2 : public DataStruct { 
  wv>   // define data members here public: 
  wv>   Struct2( FILE *f, int Key ); 
  wv>   virtual ~Struct2(); 
  wv>   virtual void Process(); 
  wv>   virtual void Edit(); 
  wv>   virtual void Save(); 
am i right in thinking that the virtual keyword belongs only in the base
class and that the derived classes have no virtual functions (unless
they're bases to another class) ???

--- Maximus/2 2.01wb


* Origin: OS/2 Connection {at} Mira Mesa, CA (1:202/354)
SEEN-BY: 12/2442 54/54 620/243 624/50 632/348 640/820 690/660 711/409 413 430
SEEN-BY: 711/807 808 809 934 942 712/353 623 713/888 800/1
@PATH: 202/354 301 1 209/710 209 280/1 396/1 3615/50 229/2
@PATH: 12/2442 711/409 54/54 711/808 809 934

SOURCE: echomail via fidonet.ozzmosis.com

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™.