home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!plsparc!surendra
- From: surendra@plsparc.UUCP (Surendra Goel)
- Newsgroups: comp.lang.c++
- Subject: possible bug in MSC7.0 ....
- Keywords: Multiple Inheritence, Virtual Base Class, MSC7.0
- Message-ID: <435@plsparc.UUCP>
- Date: 31 Dec 92 14:53:46 GMT
- Organization: Personal Library Software Inc., Rockville MD
- Lines: 56
-
-
- What is wrong with these classes? Is this a bug in MSC 7.0 compiler?
- The problem is with "virtual base class". If I remove the
- "virtual" keyword from the abstract base class then it does not complain.
- Is anybody from Microsoft is aware of this problem?
-
- See the error message generated by the compiler after the class listing.
-
- ---------------------------- begins here -----------------------------------
-
- class TestBase {
- protected:
- TestBasew();
- virtual ~TestBase();
- public:
- virtual int test() = 0;
- };
- class TestBase1 : virtual public TestBase {
- protected:
- TestBase1();
- virtual ~TestBase1();
- public:
- virtual int test() = 0;
- virtual int test1() = 0;
- };
-
- class TestBase2 : virtual public TestBase {
- protected:
- TestBase2();
- virtual ~TestBase2();
- public:
- virtual int test() = 0;
- virtual int test2() = 0;
- };
-
- class TestDer : public TestBase1, public TestBase2 {
- public:
- TestDer() {};
- ~TestDer() {;};
- int test();
- int test1();
- int test2();
- };
- -------------------------------------- ends here ----------------------------
- cl /c test.cpp
-
- test.cpp
- test.cpp(38) : error C2248: 'TestBase::~TestBase' : cannot access 'protected' member declared in class 'TestBase'
-
-
-
- PS: I am not aware of any restriction on protected member in the derived
- class.
- --
- Surendra Goel (surendra@pls.com)
- Personal Library Software, Inc. 2400 Research Blvd. Suite 350, Rockville, MD 20850 Phone: (301)926-1402
-