Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

another question on constructors

 
Rajani Sudhakar
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Question: You can only call public and protected constructors of the
super class in a subclass if the subclass is not in the
same package because only those are inherited.




Correct Answer : false


Can anyone explain me why the above statement is false...

Thanks in advance..

regards..
rajani.,

(changed title so that people know which is which)
[ May 14, 2004: Message edited by: Barry Gaunt ]
 
Barry Gaunt
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Question: You can only call public and protected constructors of the
super class in a subclass if the subclass is not in the
same package because only those are inherited.


For the above to be true, there must be another condition on the superclass: it must be public to be visible to the subclass. So IMHO, in the general case, the above answer of "false" is correct.
[ May 15, 2004: Message edited by: Barry Gaunt ]
 
Ana Abrantes
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Constructors are not inherited.
 
Rajani Sudhakar
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I got the point....
Constructors are not inherited..

Thanks for ur reply..

regards..
rajani.
 
Barry Gaunt
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You have forgotten constructors wirh default (package) access.
[ May 15, 2004: Message edited by: Barry Gaunt ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic