Javatpoint Logo
Javatpoint Logo

F# Constructor

In F#, constructor is somewhat different than other .Net languages. There are always a primary constructor that may or may not have parameters. Scope of these parameters are throughout the class.

You can create a new additional constructor by using new keyword. Body of constructor must invoke the primary constructor specified at the top of the class declaration.


F# Constructor Example

Output:

FSharp

F# Non-parameterized Constructor

Output:

This is non parametrized constructor

F# Parameterized Constructor

Output:

100 Rajkumar 25000.00
101 john 26000.00
Next TopicF# Self Identifier




Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials


Preparation


B.Tech / MCA