![]() |
#2
rjsp2016-03-22 14:34
|
#include <iostream>
using namespace std;
class Circle
{
private:
double radius;
const double PI;
public:
Circle(double n):radius(n),PI(3.1415925){
}
void Set(double n){
radius=n;
}
double getArea()const
{
return PI*radius*radius;
}
void Show();
void Show()const;
};
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
void Circle::Show()
{
cout<<getArea()<<"非常成员函数"<<++radius<<endl;
}
void Circle::Show ()const
{
cout<<getArea()<<"常成员函数"<<radius<<endl;
}
int main(int argc, char *argv[]) {
Circle c1(2);
c1.Show();
Circle const c2(2);
c2.Show();
return 0;
}