![]() |
![]() |
Articles / TULARC / Software / OO Technology / | ![]() |
|
![]() |
||||
![]() |
![]() |
|||
![]() |
![]() |
|||
![]() |
||||
|
|
||||
![]() |
![]() |
|||
![]() |
4.3) Can I Use Multiple-Polymorphism Or Multi-Methods In C++? (Object-Oriented Technology) |
![]() |
||
![]() |
||||
![]() |
![]() |
![]() |
||
![]() |
||||
![]() |
![]() |
![]() |
![]() |
||
![]() |
||
![]() |
![]() |
![]() |
![]() |
||
|
|
||
![]() |
||
![]() |
![]() |
![]() |
![]() |
||
![]() |
||
This article is from the Object-Oriented Technology FAQ, by Bob Hathaway rjh@geodesic.com with numerous contributions by others.
Yes, but you'll need to embed a dynamic typing scheme to do it. With dynamic
types in place, an overriding method in a derived class can explicitly check
argument types in a switch statement and invoke the desired method emulating
multiple-polymorphism [See Coplien 92].
For true CLOS multi-methods, the above technique implemented as a base function
(CLOS defgeneric), switching to specialized functions (CLOS methods, made
friends of all arguments) will provide the functional calling syntax, multiple-
polymorphism and access to parameters found in CLOS. This can require some
complex switching, which is somewhat mitigated when multiple-polymorphism
is implemented with virtual functions.
Future FAQs should contain more detail.
 
Continue to:
programming, software, coding, Object-Oriented, language, dynamic binding, constructor, destructor, overriding, methods, inheritance, reflection, persistence, MFC, real-time, polymorphism, system, database, vendor
![]() |
|
|