write a program for function overloading?
Answer Posted / krithika
#include<iostream.h>
#include<conio.h>
class a
{
public:
int area(int a)
{
cout<<"enter the side";
cin>>a;
return(a*a);
}
float area(float l,float b)
{
cout<<"enter the length and breadth":
cin>>l>>b;
return(l*b);
}
};
int main()
{
clrscr();
a e;
int a;
float l,b;
cout<<"the area of a square"<<e.area(a);
cout<<"the area of a rectangle"<<e.area(l,b);
getch();
return 0;
}
| Is This Answer Correct ? | 44 Yes | 13 No |
Post New Answer View All Answers
How do you achieve polymorphism?
Write a program to reverse a string using recursive function?
Describe these concepts: Polymorphism, Inheritance and Abstraction.
Can a destructor be called directly?
write a code for this:trailer recordId contains a value other than 99, then the file must error with the reason ‘Invalid RECORD_ID’(User Defined Exception).
Is html an oop?
What is stream in oop?
class CTest { public: void someMethod() { int nCount = 0; cout << "This is some method --> " << nCount; } }; int main() { CTest *pctest; pctest->someMethod(); return 0; } It will executes the someMethod() and displays the value too. how is it possible with our creating memory for the class . i think iam not creating object for the class. Thanks in Advance... Prakash
Why is static class not inherited?
Which method cannot be overridden?
What is the importance of oop?
Why do we use polymorphism in oops?
Can we override main method?
Where is pseudocode used?
What is the significance of classes in oop?