Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started