Namespaces
Variants
Actions

Difference between revisions of "intro/polymorphism"

From cppreference.com
(Created page with "The generic definition of the word '''polymorphism''' is ''the occurrence of something in several different forms''. When considered relative to computer science, software en...")
 
Line 1: Line 1:
The generic definition of the word '''polymorphism''' is ''the occurrence of something in several different forms''.  When considered relative to computer science, software engineering, and all things related to developing a software system, it is often said that polymorphism is lacks a clear explanation.  Nothing could be further from the truth.  In this section, you will gain an understanding of polymorphism, including theory and practice, as it applies to C++
+
{{title|Introduction to Polymorphism in C++}}
  
 +
'''''This is a work in progress, it is incomplete at this time'''''--[[User:Draymer|Draymer]] ([[User talk:Draymer|talk]]) 08:58, 14 October 2013 (PDT)
  
== Polymorphism: Just the C++ facts ==
+
 
 +
The generic definition of the word '''polymorphism''' is ''the occurrence of something in several different forms''.  When considered relative to computer science, software engineering, and all things related to developing a software system, it is often said that polymorphism is lacks a clear explanation.  Nothing could be further from the truth.
 +
 
  
 
In 1985, Luca Cardelli and Peter Wegner released their seminal paper '''''On Understanding Types, Data Abstraction and Polymorphism'''''.  The work built on work previously done by Liskov and Strachey, to provide a clear definition of polymorphism in modern software systems. C++ provides some of the richest support for the varied types of polymorphism as well the concepts of '''type''' and '''class'''.
 
In 1985, Luca Cardelli and Peter Wegner released their seminal paper '''''On Understanding Types, Data Abstraction and Polymorphism'''''.  The work built on work previously done by Liskov and Strachey, to provide a clear definition of polymorphism in modern software systems. C++ provides some of the richest support for the varied types of polymorphism as well the concepts of '''type''' and '''class'''.
  
We'll start with the concepts of '''type''' and '''class''' in C++, as the rest of this article depends on these fundamental concepts.  The type of an object is defined by ''what it can do'', the class of an object determines the implementation of the what, or rather, ''how what it can do gets done''.  This concept can also be seen in the adage, "''Implement to interface, not  implementation.''".  In C++11, for the first time, the developer has the capability to implement constructs that in spirit, embody the concept of ''type''/''interface'' than ever before.
 
  
editors note: saving what I have to go research the correct mechanism to put samples into a wiki article.
+
In this section, you will gain an understanding of polymorphism, including theory and practice, as it applies to C++. To prevent this from becoming a tome, I will delegate several issues to the C++ FAQs. There are two mechanisms in C++ that are used for the purpose of polymorphism.  The first one is inheritance based, and the second one makes use of the C++ mechanism for parameterized types, templates.  We'll start with inheritance based polymorphism, and then talk about polymorphism via templates.
 +
 
 +
== Inheritance based Polymorphism in C++ ==
 +
 
 +
== Template based Polymorphism in C++ ==

Revision as of 07:58, 14 October 2013


This is a work in progress, it is incomplete at this time--Draymer (talk) 08:58, 14 October 2013 (PDT)


The generic definition of the word polymorphism is the occurrence of something in several different forms. When considered relative to computer science, software engineering, and all things related to developing a software system, it is often said that polymorphism is lacks a clear explanation. Nothing could be further from the truth.


In 1985, Luca Cardelli and Peter Wegner released their seminal paper On Understanding Types, Data Abstraction and Polymorphism. The work built on work previously done by Liskov and Strachey, to provide a clear definition of polymorphism in modern software systems. C++ provides some of the richest support for the varied types of polymorphism as well the concepts of type and class.


In this section, you will gain an understanding of polymorphism, including theory and practice, as it applies to C++. To prevent this from becoming a tome, I will delegate several issues to the C++ FAQs. There are two mechanisms in C++ that are used for the purpose of polymorphism. The first one is inheritance based, and the second one makes use of the C++ mechanism for parameterized types, templates. We'll start with inheritance based polymorphism, and then talk about polymorphism via templates.

Inheritance based Polymorphism in C++

Template based Polymorphism in C++