4.1.1封装的意义
#include <iostream>
using namespace std;
const double pi= 3.1415926;
class circle
{
public:
int r;
double calc()
{
return 2 * pi*r;
}
};
int main4_1_1()
{
circle c1;
c1.r = 5;
cout << c1.calc() << endl;;
system("pause");
return 0;
}
3.4函数重载注意事项
#include <iostream>
using namespace std;
void func(int &a)
{
cout << "aaa" << endl;
}
void func(const int &a)
{
cout << "bbb" << endl;
}
void func2(int a,int b=10)
{
cout << "ccc" << endl;
}
void func2(int a)
{
cout << "ddd" << endl;
}
int main3_4()
{
system("pause");
return 0;
}