const 的重载
基于返回值是否是const 可以重载函数。 const 类对象成员。
const 对象只能使用const 成员。
类对保护成员的访问。
protected 不能被基类的对象访问,可以被基类的代码访问,派生类的代码可以访问基类的保护成员和自己的保护成员
例如:
void bulk_item::menfun(const bulk_item & temp, const item_base & tem)
{
// price is protected
sale_price=price; // ok sale_price = this->price;
sale_price=temp.price; // ok this class is bulk_item
sale_price=tem.price ; //error this class is item_base.
}