Professional Documents
Culture Documents
INHERETANCE
Is An Technique Used To Inherit Attributes And
Methods From One Class To Another
SUPER CLASS
}
//methods
}
OVERRIDING CONSTRUCTOR
OVERRIDING CONSTRUCTOR
You are required to call the constructor of the
superclass
class person { class toddler extends person{
} }
}
SUPER KEYWORD
Super keyword can only be used by a subclass
and it is used to call their superclass so we can
access their constructors, attributes and
methods
OVERRIDING METHOD
To retain functionality from the super class use the
super keyword with the method name
class person { class toddler extends person{
Void makesound(){
//oink
}
}
ACTIVITY
Apply this technique (polymorphism) on your own ..
Create any class that could act as the superclass and
make subclasses that will inherit from that super class