Re: warning missing

From: Thomas Hallgren <thhal(at)mailblocks(dot)com>
To: Gaetano Mendola <mendola(at)bigfoot(dot)com>
Subject: Re: warning missing
Date: 2004-06-23 20:25:18
Message-ID: 40D9E72E.1050407@mailblocks.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message markw 2004-06-23 21:24:54 DBT-2 results using tablespaces
Previous Message Tom Lane 2004-06-23 19:26:49 Re: PREPARE and transactions