KOTLIN Restricting Access | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

KOTLIN Restricting Access

Restricting Access Someone modified your code to restrict public access to the width and height properties. However, there are mistakes in the code and it does not run. Fix the given code, so that width and height are accessible only in the derived classes, and the class functions are accessible from main.

5th Dec 2022, 5:11 PM
Zocimo Orozco Valencia
2 Answers
+ 3
The "protected" modifier gives access to methods and properties only for derived classes.
5th Dec 2022, 6:12 PM
Tibor Santa
Tibor Santa - avatar
0
ready i was confused because i didnt needed to change "public. "
7th Dec 2022, 5:02 AM
Zocimo Orozco Valencia