Unit III Oopm
Unit III Oopm
1. Single Inheritance
2. Multiple Inheritance
3. Hierarchical Inheritance
4. Multilevel Inheritance
5. Hybrid Inheritance (also known as Virtual
Inheritance)
1. Single Inheritance: In single inheritance, a
class is allowed to inherit from only one
class. i.e. one sub class is inherited by one
base class only.
Single Inheritance:
Syntax:
A car is a vehicle.
Orange is a fruit.
A surgeon is a doctor.
A dog is an animal.
Inheritance is uni-directional.
Inheritance is indicated by a solid line with
a arrowhead pointing at the super class.
Association
If two classes in a model need to
communicate with each other, there must be
a link between them, and that can be
represented by an association (connector).