vimalalex
asked on
COM/DCOM
Hi experts,
what is the use of ATL_NO_VTABLE macro what it actually does. Is it disable the vtable of the base classes or the current class.
Regards,
Vimal.
what is the use of ATL_NO_VTABLE macro what it actually does. Is it disable the vtable of the base classes or the current class.
Regards,
Vimal.
http://www.codeguru.com/fo rum/archiv e/index.ph p/t-264232 .html
According to MSDN (http://msdn.microsoft.com/en-us/library/w4baz6ss(v=VS.80).aspx), ATL_NO_VTABLE expands to declspec(novtable), which causes the linker to eliminate the vtable (and all the functions it points to), and should only ever be applied to an abstract base class.
It disables the vtable of the class to which the modifier is applied, but you should not apply it to your most-derived (or any creatable) class.
It disables the vtable of the class to which the modifier is applied, but you should not apply it to your most-derived (or any creatable) class.
ASKER
Hi tgerbert,
By eliminating vtable so we cant use function overridding right if we have normal virtual function in base class.What is the necessary for eliminating vtable of base class.
regards,
vimal.
By eliminating vtable so we cant use function overridding right if we have normal virtual function in base class.What is the necessary for eliminating vtable of base class.
regards,
vimal.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi DeepuAbrahamK,
Thanks for your excellent reply.
Regards,
Vimal.
Thanks for your excellent reply.
Regards,
Vimal.
MSDN also says "You must use ATL_NO_VTABLE, and consequently declspec(novtable), with only base classes that are not directly creatable", so you shouldn't apply it to Animal in the above example because Animal doesn't contain any pure virtual functions (i.e. it can be directly created).
The point is that since you can't create an abstract base class anyway, there's no need for it to have a vtable so it can be removed to reduce code size.
The point is that since you can't create an abstract base class anyway, there's no need for it to have a vtable so it can be removed to reduce code size.