Answers for "inheritance explanation"

11

inheritance

it is used to define relationship between two class, 
which a child class occurs all the properties and behaviours of a parent class. 
Provides code reusability.
Ex: in my framework I have a TestBase class which I store 
all my reusable code and methods. My test execution classes and 
elements classes will extend the TestBase in order to reuse the code.
Posted by: Guest on November-28-2020
0

Inheritance

class Vehicle
{ 
  public Vehicle()
  { 
    System.out.print("Default "); 
  } 
} 
class Car extends Vehicle
{ 
public Car(String carName)
{ 
System.out.print(carName + ""); 
} 
} 
public class InheritanceTester
{
  public static void main(String[] args) 
  { 
    Car car=new Car("Ford");
  }
}
Posted by: Guest on August-12-2021

Browse Popular Code Answers by Language