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


Please Help Members By Posting Answers For Below Questions

What is polymorphism explain its types?

680


What is multilevel inheritance in oop?

557


Is enum a class?

604


What is polymorphism used for?

572


What are different types of JVM's? for example we use dalvik jvm for android then what about the remaining operating systems?

1652






What are the types of abstraction?

555


What is class in oop with example?

619


Can main method override?

583


Can you explain polymorphism?

583


Why do while loop is used?

575


What do you mean by variable?

576


What is debug class?what is trace class? What differences are between them? With examples.

1608


How many human genes are polymorphic?

570


what type of question are asked in thoughtworks pair programming round ?

1761


What is difference between oop and pop?

613