継承を行った子クラスは、継承元の親クラスの一種として扱われます。
その為、一部のフィールドやメソッドのみを流用する目的で継承すると、継承されている機能の一部が、誤った用途で使用できてしまう場合があります。
このような事態を避ける為には親クラスと子クラスの関係性に注意する必要があります。
親クラスのメソッド等を子クラスで全て利用する場合は良いですが、親クラスのメソッドを一部使わない場合は注意が必要です。
Go to list of users who liked
継承を行った子クラスは、継承元の親クラスの一種として扱われます。
その為、一部のフィールドやメソッドのみを流用する目的で継承すると、継承されている機能の一部が、誤った用途で使用できてしまう場合があります。
このような事態を避ける為には親クラスと子クラスの関係性に注意する必要があります。
親クラスのメソッド等を子クラスで全て利用する場合は良いですが、親クラスのメソッドを一部使わない場合は注意が必要です。
Register as a new user and use Qiita more conveniently
Go to list of users who liked