Google News
logo
F# - Interview Questions
What is static in F#?
In F#, static is a keyword. It is used to make the static field or static method. Static is not the part of the object. It has its memory space to store static data. It is used to share common properties among objects.
 
Example :
type Account(accno,name) = class  
 static let rateOfInterest = 8.8  
 member this.display()=  
  printfn "%d %s %0.2f" accno name rateOfInterest   
end  
let a1 = new Account(101,"Rajkumar")  
let a2 = new Account(102, "john")  
a1.display()  
a2.display() 
Advertisement