Inheritance—>(Is-A relationship)
Every properties and behaviour of parent class can be accessed by derived class
class A//base class
{
—–
—–
}
class B extends A//derived class
{
——
——
}
——————-
class Vehicle
{
——–
——–
}
class Car extends Vehicle
{
———
———
}
Car IS-A Vehicle
drawback:
In Inheritance,tight coupling(strong coupling) happens when a subclass is highly dependent on a specific superclass
changes in the superclass will heavily impact the subclass