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
Instructor Alec KretchJAN. 2, 2021 AT 3:53 PMstarTop Answer

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
  • A.
  • B.
  • C.
  • D.
  • E.

Was this helpful?

(Voting helps us personalize your learning experience!)

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