Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在编写一个需要从另一个类继承的类的程序。我该怎么做呢?
我正在使用 Code::Blocks 12.11 进行编译
class ChildClass : public ParentClass { };
public说要让所有成员成为公共的ParentClass(如果他们在 中是公开的ParentClass)。或者,您可以使用protected或private将 的成员隐藏ParentClass在ChildClass.
public
ParentClass
protected
private
ChildClass