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