define polymorphism

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • E. Robert Tisdale

    #1

    define polymorphism

    polymorph just means "many form(s)".
    The definition in plain English

    http://www.bartleby.com/61/66/P0426600.html

    and narrower definitions in the context of computer programming




    don't really help us understand what polymorphism means
    in the context of the C++ computer programming language.

    Simple operator overloading could be polymorphism.
    Generic programming with templates could be polymorphism.
    Or polymorphism may be restricted specifically
    to run-time (dynamic binding) of a function call to it's implementation
    (virtual functions).
  • EventHelix.com

    #2
    Re: define polymorphism

    In general usage of the term, it refers to inheritance with runtime
    binding.

    The Liskov Substitution Principle would be a good explaination of
    polymorphism:
    http://www.eventhelix.com/RealtimeMa..._principle.htm

    Deepa
    --
    Sequence diagram based systems engineering and architecture design tool. Built in support for alternative scenarios and multi-tier architectures.

    EventStudio 2.5 - Generate Sequence Diagrams from plain text input

    Comment

    • Rolf Magnus

      #3
      Re: define polymorphism

      E. Robert Tisdale wrote:
      [color=blue]
      > polymorph just means "many form(s)".
      > The definition in plain English
      >
      > http://www.bartleby.com/61/66/P0426600.html
      >
      > and narrower definitions in the context of computer programming
      >
      > http://en.wikipedia.org/wiki/Polymorphism
      >[/color]
      http://wombat.doc.ic.ac.uk/foldoc/fo...&action=Search[color=blue]
      >
      > don't really help us understand what polymorphism means
      > in the context of the C++ computer programming language.
      >
      > Simple operator overloading could be polymorphism.[/color]

      That's not considered to be polymorphism.
      [color=blue]
      > Generic programming with templates could be polymorphism.[/color]

      That is sometimes called "compile-time polymorphism".
      [color=blue]
      > Or polymorphism may be restricted specifically
      > to run-time (dynamic binding) of a function call to it's implementation
      > (virtual functions).[/color]

      This is what is usually meant by the term "polymorphi sm".

      Comment

      • Dave O'Hearn

        #4
        Re: define polymorphism

        E. Robert Tisdale wrote:[color=blue]
        > polymorph just means "many form(s)".
        > The definition in plain English
        > [url]
        > and narrower definitions in the context of computer programming
        > [urls]
        > don't really help us understand what polymorphism means
        > in the context of the C++ computer programming language.
        >
        > Simple operator overloading could be polymorphism.
        > Generic programming with templates could be polymorphism.
        > Or polymorphism may be restricted specifically
        > to run-time (dynamic binding) of a function call to it's
        > implementation (virtual functions).[/color]

        I liked the wiki's description. It would put overloading as a form of
        ad-hoc polymorphism, templates as parametric polymorphism, and virtual
        functions as subtyping polymorphism.

        I have heard templates referred to as "parametric polymorphism" in a
        lot of places. Stroustrup does it on page 347 of TC++PL, and Google
        gives a lot of matches for (templates "parametric polymorphism"). So
        that seems already to be accepted.

        The wiki's terminology of "ad hoc polymorphism" for overloading is
        something I had never heard before, though. It doesn't really feel like
        polymorphism to me. I usually consider overloading to be syntactic
        sugar, if very useful syntactic sugar.

        --
        Dave O'Hearn

        Comment

        Working...