Reference for C++ Virtual Pointer.
Questions tagged [vptr]
94 questions
-1
votes
1 answer
Vptr with default constructors vs explicitly declared constructors
The compiler inserts code into the beginning of the constructor that initializes the VPTR. Is this operation influenced by whether the constructor is the default one or it is explicitly declared? Is there any difference between the two?

Laura Maftei
- 1,863
- 1
- 15
- 25
-2
votes
1 answer
Why is the vptr discarded when I copy objects?
Example
#include
#include
#include
#include
struct father
{
int variable;
father(){variable=0xEEEEEEEE;};
virtual void sing(){printf("trollolo,%x\n",variable);}
~father(){};
};
struct…

Ohnemichel
- 324
- 2
- 9
-4
votes
1 answer
Is a data race on vptr explicitly illegal?
Before you go further, a note: this is purely a language lawyer question. I wish to get answers based on standard quotes. I am not looking for advice on writing C++ code. Please answer as if I was a compiler writer.
During construction of an object…

curiousguy
- 8,038
- 2
- 40
- 58
-4
votes
2 answers
Concept of vptr and vtable in C++
Why only default constructor only able to create vptr(Virtual Table Pointer) and vtable(Virtual Table)? Why parameter constructor not able to

Abhishek Tripathi
- 33
- 8