Look up section of Inheritance from the book/tutorials you're following. It tells the compiler that the class ColorLink 'inherits' publicly from the existing class Link.
It is in no way different. ColorLink and unit_in_rect are deriving classes.
Link and std::unary_function<const Unit, bool> are base classes.
std is a namespace.
unary_function is a template for a class.
A) PUBLIC
class derived_class_name: public base_class_name
derived_class_name will inherit protected, private, public members
B) PRIVATE
class derived_class_name: private base_class_name
derived_class_name will inherit members protected, private ... Member public is not accessible in the class / instance.
C) PROTECTED
class derived_class_name: public base_class_name
derived_class_name will inherit member protected only. Members private and public are not accessible in the class / instance.
class Base
{
private: A
protected: B
public: C
};
class Derived: private Base
{
private: B, C
};
class Derived: protected Base
{
protected: B, C
};
class Derived: public Base
{
protected: B
public: C
};
As you can see, users of Derived can never access private members of Base, no matter what kind of inheritance is used.
As for B and C they get "inserted" in the Derived class as shown above.
1) private members are not inherited at all
2) protected members and public members are degraded to private level if :private is used (and these are inherited).
3) protected members stays protected, but public members are degraded to protected level when :protected is used (and these are inherited)
4) when :public is used, then protected stays protected and public stays public (and these are inherited).