Answer Posted / chandra
Vtable consists of function pointers pointing to the
virtual functions of their respective class.
Ex: Class A
{
public:
virtual void fun1();
virtual void fun2();
};
Class B: public A
{
public:
Virtual void fun2();
};
Now there will be 2 vtables created for the 2 classes. in
first vtable there will be 2 function pointers pointing to
fun1 and fun2.
one more vtable is created for the class B. in which this
vtable also consists of two function pointers because class
B is derived from class A. so all the functions are
derived . so in this vtable two function pointers are
present. one function pointer pointing to fun1 and one more
function pointer pointing to fun2 of derived class.
| Is This Answer Correct ? | 4 Yes | 0 No |
Post New Answer View All Answers
When not to use object oriented programming?
is there any choice in opting subjects like 4 out of 7
What is difference between oop and pop?
Why do we need polymorphism in c#?
Are polymorphisms mutations?
what's the basic's in dot net
Can we define a class within the interface?
what is the sylabus for priliminaries?
Why do while loop is used?
Can an interface inherit a class?
This program numbers the lines found in a text file. Write a program that reads text from a file and outputs each line preceded by a line number. Print the line number right-adjusted in a field of 3 spaces. Follow the line number with a colon, then one space, then the text of the line. You should get a character at a time and write code to ignore leading blanks on each line. You may assume that the lines are short enough to fit within a line on the screen. Otherwise, allow default printer or screen output behavior if the line is too long (i.e., wrap or truncate). A somewhat harder version determines the number of spaces needed in the field for the line numbers by counting lines before processing the lines of the file. This version of the program should insert a new line after the last complete word that will fit within a 72-character line.
Where You Can Use Interface in your Project
What is a superclass in oop?
What is class encapsulation?
How Do you Code Composition and Aggregation in C++ ?