473,386 Members | 1,883 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

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

http://en.wikipedia.org/wiki/Polymorphism
http://wombat.doc.ic.ac.uk/foldoc/fo...&action=Search

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).
Jul 22 '05 #1
3 7405
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
--
http://www.EventHelix.com/EventStudio
EventStudio 2.5 - Generate Sequence Diagrams from plain text input

Jul 22 '05 #2
E. Robert Tisdale wrote:
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
http://wombat.doc.ic.ac.uk/foldoc/fo...&action=Search
don't really help us understand what polymorphism means
in the context of the C++ computer programming language.

Simple operator overloading could be polymorphism.
That's not considered to be polymorphism.
Generic programming with templates could be polymorphism.
That is sometimes called "compile-time polymorphism".
Or polymorphism may be restricted specifically
to run-time (dynamic binding) of a function call to it's implementation
(virtual functions).


This is what is usually meant by the term "polymorphism".
Jul 22 '05 #3
E. Robert Tisdale wrote:
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).


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

Jul 22 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

37
by: Mike Meng | last post by:
hi all, I'm a newbie Python programmer with a C++ brain inside. I have a lightweight framework in which I design a base class and expect user to extend. In other part of the framework, I heavily...
18
by: Ken | last post by:
Hi. Can anyone refer me to any articles about the compatibility between c++ polymorphism and real-time programming? I'm currently on a real-time c++ project, and we're having a discussion...
11
by: richard pickworth | last post by:
Can anyone explain polymorphism?(very simply). thanks richard
13
by: Krivenok Dmitry | last post by:
Hello all! Perhaps the most important feature of dynamic polymorphism is ability to handle heterogeneous collections of objects. ("C++ Templates: The Complete Guide" by David Vandevoorde and...
18
by: Seigfried | last post by:
I have to write a paper about object oriented programming and I'm doing some reading to make sure I understand it. In a book I'm reading, however, polymorphism is defined as: "the ability of two...
2
by: sarathy | last post by:
Hi all, I need a small clarification reg. Templates and Polymorphism. I believe templates is really a good feature, which can be used to implement generic functions and classes. But i doubt...
11
by: chsalvia | last post by:
I've been programming in C++ for a little over 2 years, and I still find myself wondering when I should use polymorphism. Some people claim that polymorphism is such an integral part of C++,...
3
by: well_doing | last post by:
I have something like this in declaration. union allInOne{ struct simple_s { int a; int b; } s; struct complex_s { int a; int b;
17
by: Bart Friederichs | last post by:
Hello, I created the following inheritance: class Parent { public: void foo(int i); }; class Child : public Parent {
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.