Re: warning missing - Mailing list pgsql-hackers

From Thomas Hallgren
Subject Re: warning missing
Date
Msg-id 40D9E72E.1050407@mailblocks.com
Whole thread Raw
In response to Re: warning missing  (Gaetano Mendola <mendola@bigfoot.com>)
Responses Re: warning missing
List pgsql-hackers
Gaetano Mendola wrote:
> Thomas Hallgren wrote:
> 
>>
>> Speaking in generic OO terms, using inheritance, you cannot remove
>> attributes that are present in the generalisation. If B inherits A, an
>> instance of B is per definition also an instance of A. Thus, you must 
>> alwasy
>> be able to cast a B into an A. In short, If you don't want the OID, you
>> cannot inherit a something that has an OID.
> 
> 
> This is not completely true:
> 
> struct B
> {
>    void foo();
> };
> 
> 
> class D : public B
> {
>    private:
>       void foo();
> 
>    public:
>       void bar();
> };
> 
> 
> as you can see a D "is a" B but the publich foo() doesn't
> appartaint to D, at least an user of D could not use foo()
> 

C++ is not exactly the model for OO semantics. It's a fairly wierd 
addition to C resulting in a hybrid language where quite a few 
constructs violates sane OO. Try to use a similar construct in a more 
elaborate OO-language (like Java, C#, etc.) and you will get an error like:

"foo() in D cannot override foo() in B; attempting to assign weaker 
access privileges; was public"

which makes a lot more sense.

Kind regards,

Thomas Hallgren

PS. This discussion doesn't really belong here. I'd be happy to continue 
it off the list though.



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: PREPARE and transactions
Next
From: markw@osdl.org
Date:
Subject: DBT-2 results using tablespaces