 Hello everyone, this is Siddheesh Kumar Uttaki here, working as assistant professor in Mechanical Engineering Department, Valchan Institute of Technology, Sholapur. Today we will be discussing about basic concepts of object-oriented programming system which can be used for developing programs. In the last video lecture, we had discussed about basic concepts of OOP-1. We had discussed about classes, objects, data abstraction, and data encapsulation. We also had discussed about the different excess specifiers which can be used for the data encapsulation concept and what is data abstraction and how are the data members and member functions are packed in a single data type called class. Falling outcome At the end of this session, students will be able to understand and explain polymorphism, inheritance, dynamic binding, and message passing. The following contents will be discussed in this video lecture. Inheritance, polymorphism, dynamic binding, and message passing. Inheritance It can be defined as the process by which objects of one class acquire the properties of objects of another class. It supports the concept of hierarchical classification. For example, the bird robin is a part of the class flying bird, which is again a part of the class bird. The principle behind this sort of division is that each derived class shares common characteristics with the class from which it is derived. So in this figure, I am able to see that the bird is the main class in which the attributes are feathers, laying eggs. These are the data members. So this hierarchical classification leads into the derived class that is flying bird and non-flying birds. They have different attributes, and this flying bird is classified into again robin and swallow and non-flying bird into penguin and kiwi. So this is the best example of inheritance concept. In object-oriented programming, the concept of inheritance provides the idea of reusability, reusability of code, which means that we can add additional features to the existing class without modifying it. This is possible by deriving a new class from the existing one. The new class will have the combined features of both the classes. The real appeal and power of the inheritance mechanism is that it allows the program to reuse a class that is almost but not exactly what he wants and to tailor the class in such a way that it does not introduce any undesirable side effect into the rest of the classes. Note that each subclass defines only those features that are unique to it without the use of classification. Each class would have to explicitly include all of its features. Now pause this video for a few seconds and list down some examples for inheritance in real world. Now the some examples for inheritance in real world is like it may be a bike vehicle. Vehicle attributes are the wheels, number of wheels, its transportation system that is the main thing. Then again it is classed into two wheeler and four wheeler vehicle. Again on based on the engine system and capacity again it is classified. So this is the best example of inheritance and the other example may be in your college this department. College is main thing. Again then there are different departments. From departments it may be mechanical, civil, CSE and IT based on the knowledge what they are. The main attribute or the feature is nothing but providing the knowledge. Polymorphism. A Greek term means the ability to take more than one form and operation may exhibit different behaviors in different instances. For example consider the operation of addition for two numbers. The operation will generate a sum if the operands ask strengths then the operation would produce a third string by concatenation. The following figure illustrates that a single function name can be used to handle different number and different types of arguments. This is something similar to a particular word having several different meanings depending on the context. Using a single function name to perform different types of task is known as function overloading. Polymorphism plays an important role in allowing objects having different internal structures sharing the same external interface. This means that a general class of operations may be accessed in the same manner even though specific actions associated with each operation may differ. Polymorphism is extensively used in implementing inheritance. Here there is a function name called draw. It may be a draw circle or it may be a draw box and draw triangle. So circle accepts only one input that is radius and box length and breadth and triangle it will be breadth and height. So in this way the same name is for the same name draw is called and it is performing different functions at different types. So this is the best example of the polymorphism concept. Dynamic Binding. Binding refers to the linking of a procedure call to the code to be executed in response to the call. Dynamic Binding means that the code associated with the given procedure call is not known until the time of the call at run time. It is associated with polymorphism and inheritance. A function call associated with polymorphic reference depends on the dynamic type of that reference. Consider the procedure draw in your last that is the polymorphism concept. By inheritance every project will have this procedure. This algorithm is however unique to each object and so the draw procedure will be redefined in each class that defines the object at run time. The code matching the object under current reference will be called. If suppose you are inputting the radius then the draw circle will be called. If suppose you are inputting breadth and height then the draw will implement the calculation of area of triangle or it may shape or it may draw the triangle based on the concept. So this is the best example of your dynamic binding. Message passing is nothing but sending and receiving of information by the objects same as people exchange information. An object oriented program consists of a set of objects that communicate with each other. The process of programming in an object oriented language therefore involves the following basic steps. First one creating classes that define objects and their behavior. Second creating objects from class definitions. Third one establishing communication among objects. Objects communicate with one another by sending and receiving information much the same way as people pass messages to one another. The concept of message passing makes it easier to talk about building systems that directly model or simulate the real world counterparts. A message for an object is a request for execution of a procedure and therefore will invoke a function procedure in the receiving object that generates the desired result. Message passing involves specifying the name of the object, the name of the function and the information to be sent. Here is an object called employee and it has a function called salary. The data member is the name when I call employee dot salary bracket name so it will display them either that particular message. Objects have a life cycle they can be created and destroyed. Communication with an object is possible as long as it is alive. These are the following references. Object oriented programming with C++ by E Balaguru Swami. Second one is gigs for gigs website for references. Thank you.