Skip to content

Instantly share code, notes, and snippets.

@patelmilanun
Created April 23, 2017 14:49
Show Gist options
  • Save patelmilanun/b30ca2f0709509c1fe174ea7c281c907 to your computer and use it in GitHub Desktop.
Save patelmilanun/b30ca2f0709509c1fe174ea7c281c907 to your computer and use it in GitHub Desktop.
#include <iostream>
using namespace std;
class overload
{
public:
void area(float r)
{
cout<<"Area is:"<<3.14*r*r<<endl;
}
void area(double base,double h)
{
cout<<"Area is:"<<base*h/2<<endl;
}
void area(int l,int w)
{
cout<<"Area is:"<<l*w<<endl;
}
};
int main() {
// your code goes here
overload o;
cout<<"Area for circle:";
o.area(10);
cout<<"Area for triangle:";
o.area(2.1,2.0);
cout<<"Area for rectengle:";
o.area(2,2);
return 0;
}
================================================output=====================================================
Area for circle:Area is:314
Area for triangle:Area is:2.1
Area for rectengle:Area is:4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment