Silly question
Ary Borenszweig
ary at esperanto.org.ar
Thu Apr 24 08:55:03 PDT 2008
janderson wrote:
> Jarrett Billingsley wrote:
>> "janderson" <askme at me.com> wrote in message
>> news:fuorvl$2j02$1 at digitalmars.com...
>>
>>> They are however in my book this is plain wrong. The whole purpose
>>> of being able to hide abstraction layers is broken. I should be able
>>> to protect inherited functions from objects that work on that level.
>>> Its a fundamental principle in C++.
>>
>> What?
>>
>> Am I the only one who can't understand what this post means?
>>
>
>
> I have a interface:
> (I'm using C++ because this won't work in D)
>
> class OnRenderI
> {
> public:
> virtual void OnRender() = 0;
> };
>
>
> I have a derived class:
>
> class A : OnRenderI
> {
> public:
> A() { GetRender().Add(Me); }
> private: //Or protected
> virtual void OnRender(); //This is good private
> }
Are you decreasing the visibility of method OnRender? I don't get it...
void foo(A a) {
a.OnRender(); // nope, it's private
OnRenderI r = (OnRenderI) a;
r.OnRender(); // Now it's public??
}
I'm sure misunderstanding something...
More information about the Digitalmars-d-learn
mailing list