Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to call nested classes inside constructor?

 
Michael Lars
Greenhorn
Posts: 20
Java jQuery Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello!

Maybe I don't have formulated the question correctly, but what i want to do is:

Product p = new C1(C2(C3(obj)));

where (classes) C1,C2,C3 are not ordered (can be random or repetitive)!

How can i do this on run-time?

Thank you!
 
Joanne Neal
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The new only applies to your C1 object. If you want to create the other objects as well you need something like this
 
Michael Lars
Greenhorn
Posts: 20
Java jQuery Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic