home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / lang / cplus / 12758 < prev    next >
Encoding:
Text File  |  1992-08-21  |  2.3 KB  |  55 lines

  1. Path: sparky!uunet!math.fu-berlin.de!news.netmbx.de!Germany.EU.net!mcsun!sunic!seunet!his!jonas
  2. From: jonas@ipcsun5.his.se (Jonas Mellin)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Object What is an OODBMS?
  5. Message-ID: <JONAS.92Aug22123325@ipcsun5.his.se>
  6. Date: 22 Aug 92 10:33:25 GMT
  7. References: <RCZ5NS@netmbx.netmbx.de> <BEVAN.92Aug12152127@jaguar.cs.man.ac.uk>
  8. Sender: news@his.UUCP
  9. Followup-To: comp.lang.c++
  10. Organization: University of Skoevde, Skoevde
  11. Lines: 41
  12. In-reply-to: bevan@cs.man.ac.uk's message of 12 Aug 92 14:21:27 GMT
  13.  
  14. In article <BEVAN.92Aug12152127@jaguar.cs.man.ac.uk> bevan@cs.man.ac.uk (Stephen J Bevan) writes:
  15.  
  16.    In article <RCZ5NS@netmbx.netmbx.de> jrobie@netmbx.netmbx.de (Jonathan Robie) writes:
  17.       When we create a new class we frequently want to use code or data 
  18.       that already exist in another class.  For instance, if we have a class 
  19.       called LinkedList we might choose to use this when implementing our 
  20.       stack.  In fact, we might say that a Stack is a LinkedList which also 
  21.       has the push() and pop() functions.  We can do this directly using a 
  22.       mechanism called inheritence:
  23.  
  24.       class Stack : public LinkedList
  25.       {
  26.       public:
  27.           void    push(int i);
  28.           int    pop();
  29.       };
  30.  
  31.       In this example we would call LinkedList the base class and Stack the 
  32.       derived class.
  33.  
  34.    Is this generally considered good use/example of inheritance?
  35.    I don't think a "Stack is a LinkedList" at all, rather a
  36.    LinkedList is a possible implementation of a Stack.  I'd therefore use
  37.    parametric rather than inclusion polymorphism to represent this (i.e.
  38.    use a template in C++ speak).  Is my preference for parametric rather
  39.    than inclusion polymorphism blinding me to some advantage in the
  40.    above?
  41.  
  42. I too prefer the view of this that Bevan has, but who is to say that
  43. Stack cannot be a LinkedList?
  44. --
  45. Disclaimer: Even a blind man may know how to C.
  46.           Cynic is just my second name. Nihilist is my third.
  47.     _____________________________________________
  48.    /      /  /    /   /\  /    /      /| /|    |E-mail: jonas@his.se
  49.   /      /--/     /    \  /    /         / |/ |     |UUCP:   ...!sunic!his!jonas
  50.  /      /  /    /    \/ / /  /      /     |    |Phone:  +46 500 77692
  51. /______________________/  \_/ onas /      |ellin|Fax:    +46 500 16325
  52. Snailmail: Jonas Mellin,Hogskolan i Skovde, Box 408, 541 28 Skovde, Sweden
  53.  
  54.                               
  55.