write a program for function overloading?
Answer Posted / selvanayaki
#include<conio.h>
#include<iostream.h>
class arith {
public:
void calc(int num1)
{
cout<<"\n\nSquare of a given number: " <<num1*num1 <<endl;
}
void calc(int num1, int num2 )
{
cout<<"\n\nSquare of a given number: " <<num1*num2 <<endl;
}
};
void main() //begin of main function
{
clrscr();
arith a;
a.calc(5);
a.calc(6,7);
getch();
}
| Is This Answer Correct ? | 25 Yes | 7 No |
Post New Answer View All Answers
What are constructors in oop?
Can a destructor be called directly?
Why is abstraction used?
What is solid in oops?
What is polymorphism explain its types?
What is difference between pop and oop?
What is difference between inheritance and polymorphism?
What is this pointer in oop?
which feature are not hold visual basic of oop?
What is difference between multiple inheritance and multilevel inheritance?
What is difference between abstraction and encapsulation?
Why do we use class in oops?
Prepare me a program for the animation of train
What is destructor example?
What is encapsulation in oops?