C++ (main.cpp):
#include <iostream>
using namespace std;
class mother {
public:
void hello()
{
cout << "Hello." << endl;
}
};
class child : public mother
{
//
};
void main()
{
child say;
say.hello();
}
說明:child繼承mother的基礎範例。
沒有留言:
張貼留言