as of my knowledge ... virtual table is created for every class which has
either a virtual function or derived from a class which has virtual
function..
suppose..B is child of A , if u create an obj for A and called virtual
method overloaded in B,then the method in A only be called...
So, in ur prog , there are 3 classes and 3 virtual tables ...
class Base
{
public:
virtual void method()
{
printf("in base virtual");
}
};
class Child : public Base
{
public:
void method()
{
printf("in child virtual");
}
};
main()
{
/* Base *b=new Child();
b->method(); // prints "in child virtual"... */
Base b;
b.method(); // prints "in base virtual "....
}
On Sat, Sep 10, 2011 at 1:05 AM, ravi maggon <[email protected]> wrote:
> let their be two classes A and B having a virtual function.
> class C derives both class A and B.
> How many virtual table does class C have?
>
>
> --
>
> Regards
> Ravi Maggon
> Final Year, B.E. CSE
> Thapar University
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
--
**Please do not print this e-mail until urgent requirement. Go Green!!
Save Papers <=> Save Trees
*BharatKumar Bagana*
**http://www.google.com/profiles/bagana.bharatkumar<http://www.google.com/profiles/bagana.bharatkumar>
*
Mobile +91 8056127652*
<[email protected]>
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.