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
  • 0 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

Ask A Question

Stats

  • Questions 120k
  • Answers 120k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer How are you displaying the view controllers in the first… May 12, 2026 at 12:15 am
  • Editorial Team
    Editorial Team added an answer As I understand it, no - all the things you… May 12, 2026 at 12:15 am
  • Editorial Team
    Editorial Team added an answer SVN version 1.5 supports removing/deleting a file from a repository… May 12, 2026 at 12:15 am

Related Questions

I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
After I was convinced that labeled breaks/continues are a total nono over here ,
After I messed up the description of my previous post on this I have
After I call getpwuid(uid) , I have a reference to a pointer. Should I
After I read a bunch of LINQ related stuff, I suddenly realized that no

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.