vtable

When should you not use virtual destructors?

Is there ever a good reason to not declare a virtual destructor for a class? When should you specifically avoid writing one? ...

QAbstractTableModel inheritance vtable problem

Here's another problem with qt: I extend a QAbstractTableModel, but I get a compiling error ( I'm using cmake) // file.h #ifndef TABLEMODEL_H #define TABLEMODEL_H #include <QAbstractTableModel> class TableModel : public QAbstractTableModel { Q_OBJECT public: TableModel(QObject *parent = 0); int rowCount(const QModelIndex &parent = QM...

Virtual functions in C# and Java

How are the virtual functions work in C# and Java ? Does it use same vtable and vpointer concept similar to C++ or is it something totally different? ...

Does every object of virtual class have a pointer to vtable?

Does every object of virtual class have a pointer to vtable? Or only the object of base class with virtual function has it? Where did the vtable stored? code section or data section of process? ...

VS2005 C++ broken vtables

Hi, I'm currently working on a quite big (and old, sigh) code base, recently upgraded to VS2005 (SP1). Me and my team are changing/updating/replacing modules in this code as we go but we have occasionally been running into problems where the vtables seems broken. I am no expert on vtables but these sure seems to be broken. The errors ma...

interface class in Managed C++

The interfaces in Managed C++ looka bit strange to me since they allow static methods and members inside them. For example, following is a valid MC++ interface. interface class statinterface { static int j; void Method1(); void Method2(); static void Method3() { Console::WriteLine("Inside Method 3"); } ...

Trouble with a vtable -- is it me, or the library?

I'm trying to use a COM library that makes use of a vtable. However, something funky is going on with the stack after I call the functions, which tells me I'm doing something wrong. The header file with the vtable definition is pasted here: pastebin.com/m2d66c18c (see in particular the code starting at line 810). An example is pasted he...

Using v-table thunks to chain procedure calls

I was reading some articles on net regarding Vtable thunks and I read somewhere that thunks can be used to hook /chain procedures calls. Is it achievable? Does anyone know how that works , also I am not able to find good resource explaining thunks. Any suggestions for that? ...

vtables for derived, concrete, classes

If I have one base class and I derive 10 different concrete derived classes from it then will each and every concrete derived class have a different vtable? ...

Virtual Table layout in memory?

how are virtual tables stored in memory? their layout? e.g. class A{ public: virtual void doSomeWork(); }; class B : public A{ public: virtual void doSomeWork(); }; How will be the layout of virtual tables of class A and class B in memory? ...

C++ Inheritance/VTable questions

Update: Replaced the destructor example with a straight up method call example. Hi, If I have the following code: class a { public: virtual void func0(); // a has a VTable now void func1(); }; class b : public a { public: void func0() { a::func0(); } void func2(); }; Is there a VTable in B? B has no virtual functio...

Why are C++ inheritance mechanisms opaque?

Why, for example, is there no language support to examine a vtable? Why can't I replace a member function with a new one? I have a gut feeling that there are ways to put such features to good use. Are there any other languages out there which allow me to do such things? ...

vtable problem with cppunit and xcode project

...

Is there any relation between Virtual destructor and Vtable

If we write virtual function it adds a vtable in object of that class. Is it true for virtual destructor too ? Is vtable used to implement virtualness of destructor ...

Size of virtual pointer-C++

What is the size of virtual pointer(VPTR) for a virtual table in C++? Also this is not a homework question...just a question that came to my mind while I was reading a C++ book. ...

C++ Separate Compilers for classes (vtables)?

I was wondering what the consequences are for compiling a class A with one compiler that doesn't allow multiple inheritance, and compiling a class B that does support it (and class B derived from class A). I don't really understand the linking process...would it be possible to use both together? What disadvantages exist for using separa...

Virtual tables are undefined

Hi, I wrote some code but I am unable to compile it: #include <cstdio> #include <vector> using namespace std; class Visitor; class Land { public: virtual void accept(const Visitor *v); }; class England : public Land { public: void accept(const Visitor *v); }; class Russia : public Land { public: void accept(const...

C++: Loading an EXE as a DLL, local vftable problem

Ok, so this one is abit long to explain so bare with me.. I have an exe named test.exe which is usually used as a stand alone application. I want to use this exe as a module (a dll) inside another application, app.exe. The code in test.exe does something really simple like: void doTest() { MyClass *inst = new MyClass(); inst->...

when is a v-table created in C++?

When exactly does the compiler create a virtual function table? 1) when the class contains at least one virtual function. OR 2) when the immediate base class contains at least one virtual function. OR 3) when any parent class at any level of the hierarchy contains at least one virtual function. A related question to this: Is it p...

Allocating an array of Derived without new[]: Pointer to Base vtable is bad

Basically, I have a pure virtual class Base, and a concrete class Derived which inherits from Base. I then allocate a piece of memory and treat it as an array of Derived via a simple cast. Then, I populate the array using =. Finally, I loop through the array, trying to call the virtual method GetIndex that is declared in Base and defined...