Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can we have one vtable shared my multiple classes

Tags:

c++

vtable

Is it possible in C++ to have one vtable shared by multiple classes? As per my understanding if a class is having a virtual function then it will generate a vtable.So every class should have its own vtable.

like image 643
anand Avatar asked Oct 16 '25 13:10

anand


1 Answers

Vtables are an implementation detail. C++ doesn't have vtables, it has virtual functions. Vtables just happen to be the most common (if not only) implementation, and the details differ.

What is it that you actually want to achieve?

like image 58
Sebastian Redl Avatar answered Oct 19 '25 04:10

Sebastian Redl