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





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA