Virtual table in class without overloading

Andrey saasecondbox at yandex.ru
Sat Apr 28 11:04:56 UTC 2018


Hello,
I have some questions about virtual table in classes.
Example 1:

class Test
{
     void someMethod() { ... }
     int anotherMethod { ... }
}

Will this class have a vtable?

Example 2:
class Test2 : Test
{
     void thirdMethod() { ... }
}

Will this class have a vtable?

In C++ these classes don't have any vtables. What about D? In D 
all methods are virtual by default in classes. Will complier 
optimize and remove table of virtual functions because in these 
examples we see no method overloading.

Thanks.


More information about the Digitalmars-d-learn mailing list