home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.lang.c++:12282 comp.object:3188 comp.databases:6081
- Path: sparky!uunet!mcsun!uknet!mucs!m1!bevan
- From: bevan@cs.man.ac.uk (Stephen J Bevan)
- Newsgroups: comp.lang.c++,comp.object,comp.databases
- Subject: Re: Object What is an OODBMS?
- Message-ID: <BEVAN.92Aug12152127@jaguar.cs.man.ac.uk>
- Date: 12 Aug 92 14:21:27 GMT
- References: <RCZ5NS@netmbx.netmbx.de>
- Sender: news@cs.man.ac.uk
- Followup-To: comp.lang.c++
- Organization: Department of Computer Science, University of Manchester
- Lines: 27
- In-reply-to: jrobie@netmbx.netmbx.de's message of 12 Aug 92 07:02:30 GMT
-
- 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?
-
- bevan
-