Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Initialization

 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I got a question:
What exactly does it mean by doing the following?
classA{
/*some code*/
}
classB{
/*some code*/
}
classClient{
classA xyz = new classB();
/*some code*/
}
Assuming, classB is assignable to classA.
Does this mean that xyz is an instance of classB or classA? And which constructor will be call?
Thanx
------------------
 
Kishan Kumar
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The object will be an instance of class B and the referenced type
is of type class A
The class B constructors will be called as the object belongs to B.
Hope this helps
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic