You can use this assignment in your class!
Mastery Progress(100.0%)
i

Object-Oriented Programming (OOP) in Python Assignment

Code that reads as follows:

class ClassA:
    def __init__(self, val):
        self.__val = val
        
class ClassB(ClassA):
    def get_val(self):
        return self.__val
        
obj = ClassB(15)
print(obj.get_val())Figure A
You answeredJUST NOW

Did you like this question?

(Voting helps us personalize your learning experience!)
imgInstructor solution
Alec KretchJAN 2, 2021, 3:53:04 PM

Was this helpful?

(Voting helps us personalize your learning experience!)
imgObject-Oriented Programming (OOP) in Python presentation (pages 5-7, 12)

Was this helpful?

(Voting helps us personalize your learning experience!)
Think you've got it?
  • Code as follows:

class ClassA:
    def __init__(self, val):
        self.__val = val

class ClassB(ClassA):
    def get_val(self):
        return self.__val

obj = ClassB(15)
print(obj.get_val())Figure A
Select one of the following options:
  • A.
  • B.
  • C.
  • D.
  • E.
Submit answer

Was this helpful?

(Voting helps us personalize your learning experience!)

You may exit out of this review and return later without penalty.