Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

init method code ?

 
Rahul Juneja
Ranch Hand
Posts: 425
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Will this Code work fine ? Please note super.init() is not the first line.

 
Nathaniel Stoddard
Ranch Hand
Posts: 1258
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If your question is actually "Can I call 'super.init' anywhere in a method and not necessarily on the first line: yes, you can. A call to a super constructor has to be the first line, or a call to a separate constructor has to be on the first line. But calling an overridden method can be done at any point in the method.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic