Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 76379
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T20:39:51+00:00 2026-05-10T20:39:51+00:00

After I’ve seen this PDC session I wanted to try to learn a bit

  • 0

After I’ve seen this PDC session I wanted to try to learn a bit of F#. So I thought the best way would be to rewrite in F# something I’ve already done in C# but my brain just refuses to think in functional mode. I have this abstract class that has some abstract methods and some virtual methods. I would like to override some of virtual methods as well. This class is written in C# and compiled and I don’t intend to rewrite it i F#. So my question is:

  1. does anyone have a short sample of how to implement an abstract class, abstract method and virtual method
  2. can I have overloaded constructors?
  3. are there any constraints if I want to compile it in a dll and make it available to my C# based programs.

Any help would be appreciated.


Update: I really really appreciated Brian’s answer but it is still not clear to me so I want to clarify. Let’s pretend this is my abstract class written in C# and compiled in dll. How do I implement it in F#?

public abstract class MyAbstractClass {     public abstract Person GetFullName(string firstName, string lastName);      public abstract bool TryParse(string fullName, out Person person);      public virtual IEnumerable<Person> GetChildren(Person parent)     {         List<Person> kids = new List<Person>();         foreach(Child person in GroupOfPeople)         {             if(person.Parent == parent)                kids.Add(child as Person);         }         return kids;     }      public virtual IEnumerable<Child> GroupOfPeople { get; set; } } 

Some documentation for whomever is looking for some F# resources: – if any other F# is interested to get some documentation I found on Don Syme’s (creator of F#) blog free chapters of his book F# Expert. You can download those in doc format.

  • Real World Functional Programming by Tomas Petricek has free chapter here

Some other resources that might of interest:

  • Scott Hanselman’s blog post
  • Dustin Campbell’s blog
  • Tomas Petricek’s blog
  • The place for F# – hubFS
  • F# WIKI
  • Microsoft Research
  • 1 1 Answer
  • 2 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T20:39:52+00:00Added an answer on May 10, 2026 at 8:39 pm

    Here’s some sample code

    type IBaz =     abstract member Baz : int -> int  [<AbstractClass>] type MyAbsClass() =     // abstract     abstract member Foo : int -> int     // virtual (abstract with default value)     abstract member Bar : string -> int     default this.Bar s = s.Length      // concrete     member this.Qux x = x + 1      // a way to implement an interface     abstract member Baz: int -> int     interface IBaz with         member this.Baz x = this.Baz x  type MySubClass(z : int) =     inherit MyAbsClass()     override this.Foo x = x + 2     override this.Bar s = (base.Bar s) - 1     override this.Baz x = x + 100     member this.Z = z     new () = MySubClass(0)  let c = new MySubClass(42)     printfn '%d %d %d %d %d' c.Z (c.Foo 40) (c.Bar 'two') (c.Qux 41) (c.Baz 42000) 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

After reading this question , I was reminded of when I was taught Java
After lots of attempts and search I have never found a satisfactory way to
After reading a bit more about how Gnutella and other P2P networks function, I
For some reason, after submitting a string like this Jack’s Spindle from a text
After looking at this question , I think I want to wrap ThreadLocal to
After some search for a way to check endianess at compile-time I've come up
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
After reading lots of sample code into this matter, I'm trying to figure out
After reading up on the JQGrid control, I decided it would be good to
After reading this article I made a point that int () yields 0 because

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.