42. What is the purpose of the super() function in object-oriented programming?
43. What is the purpose of the super() function in object-oriented programming?
44. The purpose of name mangling is to avoid unintentional access of private class members.
45. Which of these is a private data field?
def Demo:
def __init__(self):
__a = 1
self.__b = 1
self.__c__ = 1
__d__= 1
def Demo:
def __init__(self):
__a = 1
self.__b = 1
self.__c__ = 1
__d__= 146. What will be the output of the following Python code?
class A:
def __init__(self,x=3):
self._x = x
class B(A):
def __init__(self):
super().__init__(5)
def display(self):
print(self._x)
def main():
obj = B()
obj.display()
main()
class A:
def __init__(self,x=3):
self._x = x
class B(A):
def __init__(self):
super().__init__(5)
def display(self):
print(self._x)
def main():
obj = B()
obj.display()
main()