我下面有这段代码,我无法找到ContractB类:public:ContractA是什么意思? #include
using namespace std;
class ContractA
{
unsigned int ether = 0;
public:
ContractA(unsigned int e) :ether(e) {}
auto sendEther() { return ether; }
};
class ContractB : public ContractA
{
unsigned int wei = 1;
public:
ContractB(unsigned int w) :wei(w) {}
auto sendWei() { return wei; }
};
int main()
{
ContractB b(0);
cout << b.sendEther() << " " << b.sendWei();
return 0;
}
它代表继承。 “ public”是访问说明符,它限制了从基类(ContractA)继承的成员的最可访问级别。
您可以阅读有关它的更多信息here。