When you extend a class, the subclass inherits all of the ........ methods from the parent class.
A.Public
B.private
C.protected
D.both A and C
Answers
Answered by
0
______✨ HEY MATE ✨______
➡️Option (D) is the right answer ✔️
➡️Option (D) is the right answer ✔️
Answered by
0
Both A and C (Option D).
when we extend a parent class, the subclass inherits all of the public as well as the private method of the parent class.
- protected methods: These are those methods which are used when we don't want the child classes to inherit this method.
- Public method: These are those methods which are used when want the subclasses to inherit or use this method.
- Private method: These are those methods which are used when we don't want the outside classes member to access this method, it is only to inherit to subclasses only.
Similar questions
Science,
6 months ago
English,
6 months ago
Math,
6 months ago
Computer Science,
1 year ago
Computer Science,
1 year ago
English,
1 year ago
Hindi,
1 year ago