[ create a new paste ] login | about

Link: http://codepad.org/hRph2ZNM    [ raw code | output | fork ]

C++, pasted on Jul 12:
#include<iostream>
using namespace std;

int param = -3;
class geometry
{
public:
	geometry(){param = 1;}
	static int retParam()
	{
		return param;
	}
	static double area(double h, double w)
	{
		return h * w;
	}
	static double area(double r)
    {
		return r * r * 3.14;
    }
};

int main()
{
	double rectangle_area = geometry::area(3, 4);
	double circle_area    = geometry::area(5);
	cout << rectangle_area << endl;
	cout << circle_area << endl;
	cout<<geometry::retParam()<<endl;
	cout<<geometry().retParam()<<endl;
	return 0;
}


Output:
1
2
3
4
12
78.5
-3
1


Create a new paste based on this one


Comments: