Question: Although not emphasized in the lecture videos, methods can also be protected like attributes. To do that you add the double underscore to the front
Although not emphasized in the lecture videos, methods can also be protected like attributes. To do that you add the double underscore to the front of the name of the method. The method is then considered to be
"private" and only used by other methods in the class. Assume you have a method in your class called "isQualified", you can run it within your class by issuing
self.isQualified sobj
# note that 'self is not needed in the parameter list
If we wanted to protect "isQualified" we would define it using the signature line "defisQualified self sobj: and execute it internally using the statement "self. isQualified sobj".
Check 'True' for this question to get full credit. This question is not a trick, so don't overthink the answer. Just check 'True.
True
O FalseAlthough not emphasized in the lecture videos, methods can also be protected like attributes. To do that you add the double underscore to the front of the name of the method. The method is then considered to be
"private" and only used by other methods in the class. Assume you have a method in your class called "isQualified", you can run it within your class by issuing
self.isQualified sobj
# note that 'self is not needed in the parameter list
If we wanted to protect "isQualified" we would define it using the signature line "defisQualified self sobj: and execute it internally using the statement "self. isQualified sobj".
Check 'True' for this question to get full credit. This question is not a trick, so don't overthink the answer. Just check 'True.
True
O False
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
