Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Base class/Derived class

807591May 7 2008 — edited May 9 2008
Hi all,
I have
class Base {
int a;
}

class Derived{
int b;
}

now if i do

Base X = new Base();
Derived D = new Derived();

It Doesn't allow me to do D=X

But it does allow me to do X=D.

whats the reason behind it. And what actually happens when i do X=D , does the copy constructor gets called ?


Thanx
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 6 2008
Added on May 7 2008
29 comments
506 views