Silly question

janderson askme at me.com
Wed Apr 23 19:40:52 PDT 2008


Jarrett Billingsley wrote:
> "Steven Schveighoffer" <schveiguy at yahoo.com> wrote in message 
> news:fuo7ac$17mn$1 at digitalmars.com...
>> Are private functions that aren't declared final in the vtable?  Instinct 
>> tells me they should not be, but maybe they are...
>>
>> -Steve
>>
> 
> They aren't, at least what a little experiment shows:
> 
> class A
> {
>     public void foo() {}
> }
> 
> class B
> {
>     private void bar() {}
> }
> 
> void main(char[][] args)
> {
>     Stdout.formatln("{}", Object.classinfo.vtbl.length);
>     Stdout.formatln("{}", A.classinfo.vtbl.length);
>     Stdout.formatln("{}", B.classinfo.vtbl.length);
> }
> 
> prints 5, 6, 5. 
> 
> 

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++.

-Joel


More information about the Digitalmars-d-learn mailing list