Loading ...
Sorry, an error occurred while loading the content.
 

How is "rename" implemented in .NET

Expand Messages
  • Markus Pilman
    Hi all, I am looking into the way Eiffel implements multiple inheritance in .NET. I understood the trick with the interfaces and the private fields (if I might
    Message 1 of 3 , Mar 1, 2011
      Hi all,

      I am looking into the way Eiffel implements multiple inheritance in .NET. I understood the trick with the interfaces and the private fields (if I might call them like this), but there is still something I am wondering how it is done: renaming.

      How does Eiffel for .NET do that? Let's assume I have these classes:

      class A

      feature
      featureA is
      do
      -- my implementation
      end

      end
      -----------------------------------------
      class B

      feature
      featureA is
      do
      -- my implementation
      end

      end
      -----------------------------------------
      class C

      inherit

      A
      rename featureA as other_featureA
      end
      B
      -----------------------------------------

      If I now have a variable which has the static type A and the dynamic type C, a call to featureA has to be a call to C.other_featureA and not to C.featureA. To do this correctly, the implementation must take in account the static type of a variable. So how is this done in Eiffel?

      Thanks a lot in advance for an answer!

      Best Markus
    • Emmanuel Stapf [ES]
      ... .Net let you define a routine that implements a routine with a different name and this is what we use. ... All calls in .NET are done via the interface
      Message 2 of 3 , Mar 1, 2011
        > might call them like this), but there is still something I am wondering
        > how it is done: renaming.

        .Net let you define a routine that implements a routine with a different name and
        this is what we use.

        > If I now have a variable which has the static type A and the dynamic type
        > C, a call to featureA has to be a call to C.other_featureA and not to
        > C.featureA. To do this correctly, the implementation must take in account
        > the static type of a variable. So how is this done in Eiffel?

        All calls in .NET are done via the interface (the static type) never through the
        implementation so that we can get the proper dynamic dispatch at runtime.

        Hope this helps,
        Manu
      • Markus Pilman
        Hi Manu, Ah I did not know that .NET has this feature. So than it makes sense! Thanks a lot for the quick answer! Best Markus ... [Non-text portions of this
        Message 3 of 3 , Mar 1, 2011
          Hi Manu,

          Ah I did not know that .NET has this feature. So than it makes sense! Thanks a lot for the quick answer!

          Best Markus

          Am 01.03.2011 um 19:55 schrieb Emmanuel Stapf [ES]:

          > > might call them like this), but there is still something I am wondering
          > > how it is done: renaming.
          >
          > .Net let you define a routine that implements a routine with a different name and
          > this is what we use.
          >
          > > If I now have a variable which has the static type A and the dynamic type
          > > C, a call to featureA has to be a call to C.other_featureA and not to
          > > C.featureA. To do this correctly, the implementation must take in account
          > > the static type of a variable. So how is this done in Eiffel?
          >
          > All calls in .NET are done via the interface (the static type) never through the
          > implementation so that we can get the proper dynamic dispatch at runtime.
          >
          > Hope this helps,
          > Manu
          >
          >



          [Non-text portions of this message have been removed]
        Your message has been successfully submitted and would be delivered to recipients shortly.