![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Oct 2004
Posts: 3
Rep Power: 0
![]() |
when is the virtual table created?
will a virtual table created in the following scenario? if created why? if not created why? code sample: class base { virtual void print (void) { cout << "base"<<endl; } }; class derived { void print (void) { cout << "derived" << endl; } }; int main (int argc, char argv) { derived d; return 0; } |
|
|
|
|
|
#2 |
|
Programming Guru
![]() |
that isnt a virtual table there its just a few classes :/
__________________
"Put your hand on a hot stove for a minute, and it seems like an hour. Sit with a pretty girl for an hour, and it seems like a minute. THAT'S relativity." - Albert Einstein |
|
|
|
|
|
#3 |
|
Newbie
Join Date: Oct 2004
Posts: 3
Rep Power: 0
![]() |
i dont think virtual table creations is linked with no. of classes defined.
mehul. |
|
|
|
|
|
#4 |
|
Newbie
Join Date: Oct 2004
Posts: 3
Rep Power: 0
![]() |
oh a big mistake. sorry.
now look at the following: code sample: class base { virtual void print (void) { cout << "base"<<endl; } }; class derived : public base { void print (void) { cout << "derived" << endl; } }; int main (int argc, char argv) { derived d; return 0; } now the ques. is whether virtual table will be created? how many? one for base? and one for derived? there is no base class pointer scenario even then virtual table will be created? if yes why? mehul. |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|