write a program for function overloading?
Answer Posted / abhishek.karal
Program illustrating function overloading
# include<iostream.h>
# include<conio.h>
int area(int side)
{
return side*side;
}
int area(int l , int b)
{
return l*b;
}
void main()
{
clrscr();
int (*p1)(int);
int (*p2)(int,int);
p1=area;
p2=area;
cout<<"Address of area(int)="<<(unsigned int)p1<<endl;
cout<<"Address of area(int,int)="<<(unsigned int)p2<<endl;
cout<<"Invoking area(int) via p1 "<<p1(20)<<endl;
cout<<"Invoking area(int,int) via p2 "<<p2(10,20);
getch();
}
Is This Answer Correct ? | 57 Yes | 23 No |
Post New Answer View All Answers
What is difference between pop and oop?
How Do you Code Composition and Aggregation in C++ ?
write a program using c++ to implement single contiguous memory mangement techniques.display the content of the main memory after yhe allocation of jobs and percentage of the wastage of the main memory
What is class and object with example?
What is static modifier?
What is meant by multiple inheritance?
Which language is not a true object oriented programming language?
What are objects in oop?
How do you achieve runtime polymorphism?
What is the point of oop?
write a program to find 2^n+1 ?
What does no cap mean?
What is coupling in oop?
What is the purpose of enum?
officer say me - i am offered to a smoking , then what can you say