| Author |
does class inherits the constructors of super class
|
saikrishna cinux
Ranch Hand
Joined: Apr 16, 2005
Posts: 689
|
|
Does a class inherit the constructors of its superclass?
|
A = HARDWORK B = LUCK/FATE If C=(A+B) then C=SUCCESSFUL IN LIFE else C=FAILURE IN LIFE
SCJP 1.4
|
 |
Christophe Verré
Sheriff
Joined: Nov 24, 2005
Posts: 14672
|
|
|
As long as it is not private, I'd say that it does.
|
[My Blog]
All roads lead to JavaRanch
|
 |
saikrishna cinux
Ranch Hand
Joined: Apr 16, 2005
Posts: 689
|
|
Originally posted by Satou kurinosuke: As long as it is not private, I'd say that it does.
Originally posted by Satou kurinosuke: As long as it is not private, I'd say that it does.
areyou really sure about it? then why can't you give me a sample program to simulate this concept :-) thanks in advance
|
 |
Christophe Verré
Sheriff
Joined: Nov 24, 2005
Posts: 14672
|
|
Forget the crap I've posted above I'll check what I'm saying with samples when I'm not 100% sure. Constructor declarations are not members. They are never inherited and therefore are not subject to hiding or overriding. [ September 04, 2006: Message edited by: Satou kurinosuke ]
|
 |
Jesper de Jong
Java Cowboy
Bartender
Joined: Aug 16, 2005
Posts: 12911
|
|
No, constructors are not inherited. For example, if you create a class that has a constructor that takes a String, and then you create a subclass of that class, the subclass does not automatically have a constructor that takes a String. [ September 04, 2006: Message edited by: Jesper Young ]
|
Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
|
 |
 |
|
|
subject: does class inherits the constructors of super class
|
|
|