This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Murach's Python Programming and have Michael Urban and Joel Murach on-line!
See this thread for details.
Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Verification of constructor calling  RSS feed

 
Glenn Gould
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Verification of constructor calling
1) From within the same class
When you are within the same class, one constructor can call another constructor using the "this" keyword


2) Within a class hierarchy
When there is an inheritance hierarchy, the constructor of the subclass can call the constructor of the superclass using the "super" keyword


Please confirm.
 
Mala Gupta
Author
Ranch Hand
Posts: 368
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Glenn,

Verification of constructor calling
1) From within the same class
When you are within the same class, one constructor can call another constructor using the "this" keyword

2) Within a class hierarchy
When there is an inheritance hierarchy, the constructor of the subclass can call the constructor of the superclass using the "super" keyword
Please confirm.



Both of your statements are correct - as already confirmed by the code output.

With respect,
Mala



 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!