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 the 5 oop principles?
What is class in oop with example?
How to handle exception in c++, For example in a functions i am assigning memory to some variables and also in next instructions in am dividing one variable also. If this functions generates a error while allocating memory to those variable and also while dividing the variable if i divide by zero then catch block how it will identify that this error has cone from perticular instruction
How Do you Code Composition and Aggregation in C++ ?
What is abstraction encapsulation?
What is advantage of inheritance?
There are two base class B1,B2 and there is one class D which is derived from both classes, Explain the flow of calling constructors and destructors when an object of derived class is instantiated.
What does and I oop mean?
What is oops?what is its use in software engineering?
Explain virtual inheritance?
Why multiple inheritance is not possible?
What is class and example?
What is overloading in oops?
Why do we use encapsulation in oops?
How do you achieve runtime polymorphism?