Javatpoint Logo
Javatpoint Logo

F# Inheritance

Inheritance is a feature of object oriented programming approach. It allows inheriting property of base class in derived class. It increases reusability of code.

F# provides inherit keyword to use inheritance. If you don't use inherit keyword by default it inherits object class. A class can have at most one direct base class. Derived class or subclass can access all the data members of base class except let binding which is private to base class.

You can access base class data members by using base keyword it acts like super keyword in java.


F# Inheritance Example

Following example illustrates how we can achieve inheritance in F#.

Output:

Name = Rajkumar
Salary = $10000




Help Others, Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA