Question: The ____________ class member visibility allows child classes to access information they inherited from a parent class. A. Private B. Package C. Protected D. Public
The ____________ class member visibility allows child classes to access information they inherited from a parent class.
| A. | Private | |
| B. | Package | |
| C. | Protected | |
| D. | Public |
You are given a class Hero with attributes: name:str, age:int, power:float and the seter and getter methods.
You are also given an object of this class hero1 with values name="Fatma", age=18, power=100.
Which of the following is true?
I can use the setname(str) to change the name from "Fatma" to "Myriam" for example. | ||
The value of the object cannot be changed. Setname(str) is a method of the class Hero and can change only the attributes | ||
Setname(str) can only change the name from "Fatma" to "str" | ||
Setname(str) can be used only with the class and not with the objects of the class. |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
