Gopi Krishna Komanduri wrote:
> HI,
>    I have a small query. In virtual inheritence , the function wil be called 
> basing on the object we assign for the base class pointer. But how variable 
> address will be resolved. I observed that even variable are getting resolved 
> basing on the object we assign (like function). But I think there is no 
> virtual concept for variables. only for functions.
> 
> #include<stdio.h>
> #include<conio.h>
> 
> 
> class base
> {
> public:
>     int var1 , var2;
>     base(int a,int b)
>     {
>         var1=a;
>         var2=b;
>         printf("\n I am in base. var1 = %d , var2 = %d",var1 , var2);
>     };


You have not implemented virtual destructors.  Both your base class and 
all derived classes MUST have virtual destructors to be freed properly.

-- 
Thomas Hruska
CubicleSoft President
Ph: 517-803-4197

*NEW* MyTaskFocus 1.1
Get on task.  Stay on task.

http://www.CubicleSoft.com/MyTaskFocus/

Reply via email to