Click here to Skip to main content
15,921,113 members

Comments by ggupta2009 (Top 11 by date)

ggupta2009 17-Feb-12 1:04am View    
Thank you very much...
ggupta2009 16-Feb-12 0:18am View    
Is it due to standard-Input-buffer is not flushed (for scanf()) and before that printf() is called. But even then output should be initialized value of a? But as I have observed always output is 1?
ggupta2009 9-Feb-12 7:36am View    
Hi,

I have added following inside main()

Derived2 obj3;
cout<<"size of Derived1 class is: "<<sizeof(Derived1)<<endl;
cout<<"size of Derived1 class object is: "<<sizeof(obj2)<<endl;
cout<<"size of Derived2 class is: "<<sizeof(Derived2)<<endl;
cout<<"size of Derived2 class object is: "<<sizeof(obj3)<<endl;

Output:
Value of Derived2Data is: 10.9
size of Derived1 class is: 1
size of Derived1 class object is: 1
size of Derived2 class is: 4
size of Derived2 class object is: 4
ggupta2009 9-Feb-12 7:28am View    
Hi,
Even with dynamic_cast it is not working. Could you please comment on this?

I am coding like:
(dynamic_cast<diamondderived1*>(pBase))->DiamondDerived1Fun();

getting error: cannot dynamic_cast `pBase' (of type `class DiamondBase*') to type `class DiamondDerived1*' (source type is not polymorphic)
ggupta2009 9-Feb-12 7:19am View    
Thanks a lot.
Link is helpful.