4.6.1继承的基本语法
#include <iostream>
using namespace std;
class basepage
{
public:
void header()
{
cout << "header"<<endl;
}
void footer()
{
cout << "footer" << endl;
}
void left()
{
cout << "left" << endl;
}
};
class Java :public basepage
{
public:
void content()
{
cout << "Java:content" << endl;
}
};
class Python :public basepage
{
public:
void content()
{
cout << "Python:content" << endl;
}
};
void test01()
{
Java ja;
ja.footer();
}
int main4_6_1()
{
test01();
system("pause");
return 0;
}
4.5.6函数运算符调用
#include <iostream>
using namespace std;
#include<string>
class myprint
{
public:
void operator()(string test)
{
cout << test << endl;
}
};
void test01()
{
myprint mypri;
mypri("asasaassaa");
}
int main4_5_6()
{
test01();
system("pause");
return 0;
}