Polymorphism
Object
Implementation
Benefits
Object-Oriented Programming
Polymorphism is the ability of objects, inherited from a common base or parent class, to respond differently to the same message. This is done by defining different implementations of the same method name within the individual child class definitions. For example: A DogArray object, "DogArray OurDogs[2];" refers to two element objects of class Dog, the base class:
•King, of class Doberman, is a derived or child class of Dog.
•Fifi, of class Minipoodle, is a derived or child class of Dog. If, in a program, OurDogs[n]->Bark( ) is called in a loop, then:
•In iteration one ([1]), method King::Bark( ) is called.
•In iteration two ([2]), method Fifi::Bark( ) is called.
King's bark does not sound like Fifi's bark because each Bark( ) call is a separately defined method within its child object definition. The virtual parent class (Dog) method Bark( ) is defined in the class definition of Dog.
The benefits of creating RTR solutions with C++ foundation classes include the following:
•Each major RTR concept is represented by its own individual foundation class.
•Simple methods within RTR classes transform features of RTR for streamlined solutions.
•Major classes include Get and Set methods for changing transaction states.
•Default handling code is provided for all Messages and Events, where appropriate.
•You do not need to provide handling code for all messages and events.
•The sending and receiving of data is abstracted to a higher level with transaction controller and data classes.
•No buffers and links coding is needed.
•Internal RTR information is accessible without a need to know RTR internals.
Architectural Concepts