Computer Science, asked by DemonHear, 1 month ago

What is inheritance????​

Answers

Answered by XxSoloRiderXx
0

Answer:

Inheritance can be defined as the process where one class acquires the properties (methods and fields) of another. ... The class which inherits the properties of other is known as subclass (derived class, child class) and the class whose properties are inherited is known as superclass (base class, parent class).

Answered by Ᏸυէէєɾϝɭყ
29

Answer:

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

Similar questions