Oops! It appears that you have disabled your Javascript. In order for you to see this page as it is meant to appear, we ask that you please re-enable your Javascript!

C++物件導向的權限問題 public, private, protect

public
public就不用說了 就是怎麼用都可以 (public為預設值)

protected
protected 就比 private 鬆了一點 繼承類別准許存取 protected 成員 但外部使用仍然禁止

private
private宣告的函式或變數 只能由自己類別所使用
不能由外部使用 連繼承自己的類別也不能使用

發表迴響