天蓬老师2017-04-17 13:38:24
If you want to prohibit access to a class method, put this method in private and protected
class Test
{
public:
void func1();
private:
void func2();
}
Here func1 can be called from the object, func2 can only be called inside the class.
黄舟2017-04-17 13:38:24
I don’t understand...private methods cannot be called outside the class.
黄舟2017-04-17 13:38:24
Yes, write the method (function) to private: After the following, this method is a private method and can only be called in methods of this class. However, objects instantiated by this class cannot call this method. .