Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!sdd.hp.com!wuarchive!uunet!seismo!dimacs.rutgers.edu!aramis.rutgers.edu!paul.rutgers.edu!joshua From: joshua@paul.rutgers.edu (Josh Mittleman) Newsgroups: comp.lang.c++ Subject: Re: Multiple inheritence problem Message-ID: Date: 8 May 91 17:41:50 GMT References: <74462@brunix.UUCP> Organization: Rutgers Univ., New Brunswick, N.J. Lines: 46 We can simplify the picture a little: class Object { public: virtual void Draw() = 0; virtual void Update() = 0; virtual Object* Dup() = 0; }; class Line: public virtual Object { public: void Draw(); }; class Dependent: public virtual Object { public: void Update(); }; class DependentLine: public Line, public Dependent { public: Object *Dup() { return new DependentLine; }; // error here }; I'm pretty sure that the problem is that you have an ambiguity. For DependentLine not to be an abstract class, it needs to have an unambiguous definition for each pure virtual function. Dup() is defined locally, but the Update() and Draw() need to be inherited. But, there are two routes through which to inherit them: from Line, in which Update() is still pure virtual, and from Dependent, in which Draw() is still pure virtual. I can't find anything in ARM which covers this problem specifically, but obviously what's happening is that one or both of these is being inherited as pure virtual, and so DependentLine is considered abstract. I guess this is consistent with the way that C++ deal with other ambiguities: Don't flag an error until the ambiguity is actually invoked. =========================================================================== Josh Mittleman (mittle@watson.ibm.com or joshua@paul.rutgers.edu) J2-C28 T.J. Watson Research Center, PO Box 704, Yorktown Heights, NY 10598 -- ------------------------------------------------------------------------------ Joshua Mittleman (mittle@watson.ibm.com or joshua@paul.rutgers.edu) J2-C28 T.J. Watson Research Institute, PO Box 704, Yorktown Heights, NY 10598