Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
私は2つのクラスを持っています
class A { private int count; } class B extends A { //need to access count here }
アクセスするには、どのような標準的な方法を使用できますか?
でメソッドを作成count protectedまたは追加します。getCount()A
count
protected
getCount()
A
class A { private int count; public int getCount(){ return count; } } class B extends A { //need to access count here }