I have two classes: Base and Derived.
Now i create two objects :
Derived d = new Derived()
Base bd = new Derived()
I want to know the difference between 'd' and 'bd'
Thanks.
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Benjamin KemnerPosted Aug 1, 2011, 2:25 AM
i.g.
Base
|- Derived
|- Derived2
|- Dervied3
Script:
Base bd;
if(userinput == 1)
bd = new Derived();
else if(userinput == 2);
bd = new Derived2();
else if(userinput == 3)
bd = new Derived3();
else
bd = new Base();
You see "bd" can hold all derived classes.