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 8331473
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T02:25:36+00:00 2026-06-09T02:25:36+00:00

The code below produces t1 t1 t2. I wondered if someone could please tell

  • 0

The code below produces “t1 t1 t2”. I wondered if someone could please tell me how to change it so as to get “t1 t2 t2”. It is an error to use “override” instead of “member” in t2, and I don’t understand why. I am more than happy to RTFM, if only I would know where and in what FM to look.

Many thanks in advance, and sorry if I missed some fundamental reason for why what I want should not be possible.

type myinterface =
   abstract member doit : unit -> unit

type t1 () =
   interface myinterface with
      member x.doit () = printf "t1\n"

type t2 () =
    inherit t1 ()

    member x.doit () = printf "t2\n"

let override_test () =
    let t1 = t1 () :> myinterface
    let t2 = t2 ()
    let t2i = t2 :> myinterface
    t1.doit ()
    t2i.doit ()
    t2.doit ()
  • 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. Editorial Team
    Editorial Team
    2026-06-09T02:25:37+00:00Added an answer on June 9, 2026 at 2:25 am

    This should have the behavior you want:

    type myinterface =
        abstract member doit : unit -> unit
    
    type T1 () =
        interface myinterface with
            member x.doit () = printfn "t1"
    
    type T2 () =
        inherit T1 ()
        member x.doit () = printfn "t2"
        interface myinterface with
            member x.doit () = x.doit ()
    
    let override_test () =
        let t1i = T1() :> myinterface
        let t2 = T2()
        let t2i = t2 :> myinterface
        t1i.doit ()
        t2i.doit ()
        t2.doit ()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My code below produces an error, unknown modified |... I'm trying to use it
The code below produces an error saying that my input string was not in
Using PyQt4 4.8.6 the code below produces the error QObject::startTimer: QTimer can only be
The code below won't work; it produces a blank screen. But if I change
The code below produces the error: LINQ to Entities does not recognize the method
the code below produces compiler error C2784: 'bool std::operator <(const std::_Tree<_Traits> &,const std::_Tree<_Traits> &)'
The code snippet below produces an error: #include <iostream> using namespace std; class A
The code below, when executed produces the following error: Fatal error: Uncaught exception 'PDOException'
The code below produces a NumberFormatException in this line: val cache = cf.createCache(Collections.emptyMap()) Do
Given the code below, how would you create/implement SR.h so that it produces the

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.