LoginSignup
1
0

駆け出しにとっては悩ましいprivateとprotected

Posted at

注意

メモ書き程度ですので、間違っていても悪しからず。
なんなら修正コメントください。

private

  • そのクラス内でしか利用できない
  • クラス固有の機能に使う

protected

  • 親子関係にあるクラスでのみ利用可能
  • 子クラスでも利用したいときに使う

public

  • どの外部のクラスからでも利用可能
  • ビジネスロジックとして共通化された関数で使うことが多い
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0