OOP Concepts: Which property of Object Oriented Programming is exhibited by the code:

534 views
0

Which property of Object Oriented Programming is exhibited by the code:

#include< iostream>
class quest
{
public:
float add( float a, float b)
{
cout << “The sum is:”;
reurn(a+b); } }
int add( int a, int b, int c)
{
cout << ”The sum is:”;
return(a+b+c);
}

int add( int a, int b=0)
{
cout << ”The sum is:”;
return(a+b);
}
};
int main( )

{
quest q
q. add( 50.5, 48.2)
q. add( 42, 56, 82)
q. add( 23)
return 0;
}

a. Compile time polymorphism
b. Run time polymorphism
c. Both
d. none

SimplyFreshers Answered question March 3, 2022
0

ANSWER: Compile time polymorphism

Explanation:
The property of function overloading is also known as Compile time polymorphism. Here in this code we see how a function is overloaded using different datatype, different number of arguments and default argument. Function overloading is a concept which allows the use of same function name to different functions for performing same or different task in the same class.

SimplyFreshers Answered question March 3, 2022
You are viewing 1 out of 1 answers, click here to view all answers.