Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible for a F# type to "inherit" from a C# class?

Tags:

c#

f#

c#-to-f#

I have used Haskell a bit in my days but it was a long time ago so I decided to take a look at F#. I do a lot of daily development using C, C++ and C#.

I noticed that you could expose F# types as classes in C# when compiling F# to a dll. But then I came to think. I have a few C# classes I would like to put the logic of in F# (to try it out). But a lot of the existing C# code handles a lot of objects by their base class (which is very rudimentary). Would it be possible to use that base class from C# as a base for the F# types? Or can F# only inherit from other F# types?

The reason behind this would be to keep the base class as part of the main C# project and the specific dlls (kind of like plugins based on the given contract by the base class) could be written in F#. If it can't be done I would have to add yet another F# project that contains only the base class which feels a bit overly complicated.

like image 677
inquam Avatar asked Sep 17 '12 19:09

inquam


People also ask

Is atrial fibrillation life threatening?

Atrial fibrillation isn't usually life-threatening or considered serious in people who are otherwise healthy. However, atrial fibrillation can be dangerous if you have diabetes, high blood pressure or other diseases of the heart. Either way, this condition needs to be properly diagnosed and managed by a doctor.

What is the latest treatment for atrial fibrillation?

In fall 2020, the FDA approved the Thermocool Smarttouch Catheter for use in AFib patients. This new treatment offers better long-term results for those with persistent atrial fibrillation. Atrial fibrillation is a common arrhythmia, especially among older people.

What is the most common cause of atrial fibrillation?

The exact cause of atrial fibrillation is unknown, but it's more common with age and affects certain groups of people more than others. Atrial fibrillation is common in people with other heart conditions, such as: high blood pressure (hypertension) atherosclerosis.


1 Answers

Yes. It is possible.

type SomeClass =
    inherit SomeCSharpBase

Here are some more details:

Inheritance (F#)

like image 176
Justin Niessner Avatar answered Nov 12 '22 07:11

Justin Niessner