(ref.doc)maxtal 010893a

Next bs 060893 Prev: tsai 010893 Up: Usenet

Newsgroups: comp.lang.c++
From: [email protected] (John Max Skaller)
Subject: Re: abstract class & multiple inheritance
Nntp-Posting-Host: physics.su.oz.au
Organization: School of Physics, University of Sydney, Australia
Date: Sun, 1 Aug 1993 21:05:01 GMT

In article <[email protected]> "Bradley D. Keister" <[email protected]> writes:
>[I posted this a few weeks ago, and got one response, but the issue
>isn't resolved.  I have since obtained results with other compilers.]

	So I'll respond again.
>
>I have a class hierarchy which starts with a an abstract base class,
>is inherited virtually by two separate branches, and then the branches
>are brought together by multiple inheritence for the class used in the
>application.  Some pure virtual functions are declared in the base
>class which are all eventually defined along one branch, but not the
>other.  For the (multiply inherited) class I use, all functions are
>therefore defined and unambiguous.  

	The class is then not abstract. It should work fine.
BC3.1 stuffs up the definition of abstract, but if you kludge
the pures to have dummy bodies it calls the right functions.

	I'm told MSC7/8 handles this case fine.

	Due to a sample I posted to the net (cf. Mixins, Sorting)
I know that cfront 3.0.1 and below completely craps out.
The tester was Bjarne Stroustrup. 3.0.2 works fine, according
to the same tester.

>What is the correct resolution of this?  Should I be getting an error
>message?  

	No.

>CC  m2.c:
>"m2.c", line 34: error: `new' of abstract class C
>"m2.c", line 34:  int A::get_a() is a pure virtual function of class C

	Its wrong. Get cfront 3.0.2.

>class A {
>  virtual int get_a() = 0;
>};
>
>class B1 : virtual public A {
>  virtual int get_a() {return a;}
>};
>
>class B2 : virtual public A {
>};
>
>class C : public B1, public B2 {
>};
>
>  C* testc = new C;

	Believe me. I spent 6 months arguing this case.
Finally, Stroustrup told all the implementors they were wrong.
I'm rewriting the paragraphs on abstract classes to make
it clear.

	There are no dominant pure virtuals in C, so it
cant be abstract. Thats it.

--
        JOHN (MAX) SKALLER,         INTERNET:[email protected]
	Maxtal Pty Ltd,		    CSERVE:10236.1703 
        6 MacKay St ASHFIELD,	    Mem: SA IT/9/22,SC22/WG21 
        NSW 2131, AUSTRALIA	    


automatically generated by info2www version 1.2.2.8