Skip to main content

Posts

Showing posts with the label major and essential feature that make program object oriented

What are major and essential feature that make program object oriented. If a base and derived class each include a member function with same name, which member function will be called by an object of a derived class and why? Explain with example.

 The major and essential features that make a program object-oriented are: Encapsulation: The ability to hide the implementation details of a class from outside users and provide a well-defined interface for interaction with the class. Inheritance: The ability to create new classes that are derived from existing classes and inherit their properties and behavior. Polymorphism: The ability to define different behaviors for the same function or method depending on the context in which it is called. Abstraction: The ability to define and use abstract data types that can be manipulated without knowing their underlying implementation details. Now, if a base and derived class each include a member function with the same name, the member function of the derived class will be called by an object of a derived class. this is because the derived class overrides the member function of the base class with its own implementation.  Here's an example to illustrate this: #include <iostream...