What is inheritance?tell me fast
Answers
Answered by
1
Inheritance is property in which the property of a parent class(Superclass) is passed on to child class(Subclass). For example
class Abc{ —– This is a class
int a; —— This is a variable
public void abc(){} — Methods
}
class Xyz extends Abc —–(Extend is the keyword, Xyz is the subclass which inherits the properties of ABC parent class.)
{
public static void main (String args[]) ——- This is a method
{
Abc a= new Abc(); —— This is object creation where ‘a’ is the reference variable or object name
}
}
prototype88:
woo
Answered by
0
In object-oriented programming, inheritance is the mechanism of basing an object or class upon another object or class, retaining similar implementation. Also defined as deriving new classes from existing ones and forming them into a hierarchy of classes.
Similar questions
Physics,
6 months ago
Social Sciences,
6 months ago
Economy,
6 months ago
Math,
1 year ago
Social Sciences,
1 year ago
Math,
1 year ago