assignment of base class object creation to derived class variable

Posted by Sns548 under C# on 5/4/2011 | Points: 10 | Views : 2199 | Status : [Member] | Replies : 3
A is base class ,B is derived class
B b=new A();
A a=new B();
which one is correct??




Responses

Posted by: Ndebata on: 5/4/2011 [Member] Starter | Points: 25

Up
0
Down
A a=new B();
Is the correct one
Thanks,
Debata

Sns548, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sns548 on: 5/5/2011 [Member] Starter | Points: 25

Up
0
Down
ya thanks for ur respnse bt y B b=new A(); is not correct i want dis answer

Sns548, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sns548 on: 5/5/2011 [Member] Starter | Points: 25

Up
0
Down
ya u r rite but y B b=new A(); is not correct i want dis

Sns548, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response