Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!island!lars From: lars@island.COM (Lars Nyman) Newsgroups: comp.sys.mac.programmer Subject: virtual base class problems Message-ID: <3552@island.COM> Date: 5 Feb 91 01:57:22 GMT Organization: Island Graphics, Marin County, California Lines: 44 The following code using a virtual base class causes CFront to complain (Sun C++ 2.0, and MPW C++ 3.1, both which are based on CFront 2.0). IS this indeed a CFront bug, and does anybody know if it is fixed/will be fixed in later versions of CFront (> 2.0) ? // ------------------------------------------------- //#define INHERIT public #define INHERIT virtual public class TOne { public: virtual void foo() {}; }; class TTwo : virtual public TOne { public: void foo() {}; }; class TThree : INHERIT TTwo {}; class TFour : INHERIT TThree {}; class TFive : public TFour {}; class TSix : public TFive {}; class TSeven : public TSix { public: void bar() { foo(); }; }; //---------------------------------- CC foo-bug.cc CC foo-bug.cc: "foo-bug.cc", line 24: error: ambiguous TTwo::foo() and TOne::foo() (different s ub-objects) "foo-bug.cc", line 24: error: ambiguous TTwo::foo() and TOne::foo() (different s ub-objects) "foo-bug.cc", line 24: error: ambiguous TTwo::foo() and TOne::foo() (different s ub-objects) 3 errors