Why do we need to store a null value in vTable for a pure virtual function? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Why do we need to store a null value in vTable for a pure virtual function?

18th Mar 2018, 3:12 PM
Ashish Gaur
Ashish Gaur - avatar
3 Answers
+ 1
That’s to make it so you can’t call on the function unless it’s defined else where.
18th Mar 2018, 3:21 PM
Ariela
Ariela - avatar
0
if we can't create an object of a class which has pure virtual function, why do we need to store a null value in vTable, wasting memory?
18th Mar 2018, 3:23 PM
Ashish Gaur
Ashish Gaur - avatar
0
It’s a base for the inherited classes to use that method.
18th Mar 2018, 3:31 PM
Ariela
Ariela - avatar