C++ Programming :: OOPS Concepts - Discussion
10 / 14
Polymorphism is done by
Afunction overloading
BCreating new classes from base class
Coperator overloading
Dboth (a) and (c)
Show Explanation
Compile time Polymorphism: Compile time Polymorphism can be achieved using Function overloading and Operator overloading.
Function overloading: If a class has multiple functions with same name but with different number of argument or different types of arguments, then these functions are overloaded.
Operator overloading: Operator overloading means to redefine the way how a operator works. For example, we can overload '+' operator to concatenate two strings in addition to integers.
Run time Polymorphism: Run time Polymorphism in C++ can be achieved using Function overriding. when a derived class has a definition for a member function of a base class then the base version of the method is said to be overridden.
Asked In ::
There are two types of Polymorphism in C++.
Compile time Polymorphism: Compile time Polymorphism can be achieved using Function overloading and Operator overloading.
Function overloading: If a class has multiple functions with same name but with different number of argument or different types of arguments, then these functions are overloaded.
Operator overloading: Operator overloading means to redefine the way how a operator works. For example, we can overload '+' operator to concatenate two strings in addition to integers.
Run time Polymorphism: Run time Polymorphism in C++ can be achieved using Function overriding. when a derived class has a definition for a member function of a base class then the base version of the method is said to be overridden.
Read Full Answer
Report Error
Please Login First Click Here