Re: warning missing

Поиск
Список
Период
Сортировка
От Thomas Hallgren
Тема Re: warning missing
Дата
Msg-id 40D9E72E.1050407@mailblocks.com
обсуждение исходный текст
Ответ на Re: warning missing  (Gaetano Mendola <mendola@bigfoot.com>)
Ответы Re: warning missing  (Greg Stark <gsstark@mit.edu>)
Список 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 по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: PREPARE and transactions
Следующее
От: markw@osdl.org
Дата:
Сообщение: DBT-2 results using tablespaces