Inheritence
------------
is process to create a new class from an existing class.
existing class is called super class
and
new class is called derived class.
new class inherits properties of super class.
(in java main class is called super class)
in java Object is the super class of all java classes.
extends is a keyword to extend the class.
class A Object is super class. bydefault
{}
OR
class A extends Object
{}
in java any class can inherit the properties of Object class
directly without creating the object.
this class is defined in java.lang.Object package.
only derived classes can inherits the protected properties
of super class.
super
-----
is a keyword is used to access properties
of super class.
------------
is process to create a new class from an existing class.
existing class is called super class
and
new class is called derived class.
new class inherits properties of super class.
(in java main class is called super class)
in java Object is the super class of all java classes.
extends is a keyword to extend the class.
class A Object is super class. bydefault
{}
OR
class A extends Object
{}
in java any class can inherit the properties of Object class
directly without creating the object.
this class is defined in java.lang.Object package.
only derived classes can inherits the protected properties
of super class.
super
-----
is a keyword is used to access properties
of super class.
No comments:
Post a Comment
Note: only a member of this blog may post a comment.