TIP: Click on subject to list as thread! ANSI
echo: aust_c_here
to: Frank Adam
from: steven pasztor
date: 1996-11-25 15:38:04
subject: Re: #defines

Welcome Adam Frank...


Wednesday November 20 1996 10:50, Frank Adam wrote to Steven Pasztor:


 FA> class baseclass
 FA> {
 FA>  private :
 FA>          // available to base only and friends
 FA>  protected:
 FA>          // available to base,derived and friends
 FA>  public  :
 FA>          // available to every dog and its flea.
 FA>  };
 FA> class derived : public baseclass
 FA> {
 FA> };
 FA>
 FA> main()
 FA> {
 FA>  baseclass *base;
 FA>  derived *derv;
 FA>  ...
 FA> }

 If bozo() is a virtual method in baseclass, any way to call it from a
function which takes a derived as its parameter?  And more interestingly,
any way to pass a dervived to a function that expects a baseclass?

 eg. Imagine a game, where the NPC's are handled by objects.  They all have
the same mathods, and call the same methods of other objects, but some or
all of their internals are different.  Sometimes it's possible to re-use
the standard code, othertimes entirely new routines must be written.  But
always, the rest of the program doesn't want to know which NPC object it's
dealing with, because there's simply too many to handle each one
differently.  So it just wants an NPC object, which handles itself
appropriately.


nevets


... .latot egassem ruoy pu ot rotaredom a emoceB
--- FMailX 1.02
* Origin: If you go to the beach, will you hear the C? (3:632/103.123)
SEEN-BY: 633/267 270
@PATH: 632/103 348 360 50/99 635/728 633/267

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