Tutorials
C++
Elements of Object Oriented Programming
Elements of Object Oriented Programming - Page 2What is Inheritance
Inheritance is a means of specifying hierarchical relationships between types C++ classes can inherit both data and function members from other (parent) classes. Terminology: "the child (or derived) class inherits (or is derived from) the parent (or base) class"
What is Polymorphism
Polymorphism is in short the ability to call different functions by just using one type of function call. It is a lot useful since it can group classes and their functions together. Polymorphism means that the same thing can exist in two forms. This is an important characteristic of true object oriented design - which means that one could develop good OO design with data abstraction and inheritance, but the real power of object oriented design seems to surface when polymorphism is used.
In C++, polymorphism means that if the same message is sent to different objects, the object’s behavior depends on the nature of the object itself. This is sort of obvious for completely different objects, but the concept starts making sense when combined with inheritance.
What is Message passing
It is the process of invoking an operation on an object. In response to a message the corresponding method is executed in the object.
What is Extensibility
C++ allows the extension of the functionality of the existing software components. In C++ this is achieved through abstract classes and inheritance.
What is Persistence
The phenomenon where the object (data) outlives the program execution time and exists between executions of a program is known as persistence. All data base systems support persistence. In c++ it is not supported. However the user can build it explicitly using file streams in a program.
What is Delegation
Delegation is a way of making object composition as powerful as inheritance. In delegation two objects are involved in handling a request a receiving object delegates operations to its delegate. This is analogous to child class sending requests to the parent class.
What is Genericity
It is technique for defining software components that have more than one interpretation depending on the data type of parameters. Thus it allows the declaration of data items without specifying their exact data type.
What is Multiple Inheritance
The mechanism by which a class is derived from more than one base class is known as multiple inheritance. Instances of classes with multiple inheritance have instance variables for each of the inherited base classes. C++ supports multiple inheritance.
In the next chapter, we will discuss how programmer can change from c style of programming to c++ style without temporarily bothering about c++ object oriented features. Mastering the concepts of c++ without the oops concepts bolsters the confidence of the learner. Even if the learner do not want the oops concepts he has many features used in c made better and more powerful in c++.
First Page: Elements of Object Oriented Programming