Advertisements
Advertisements
प्रश्न
What is the output of the following program?
class Greeting:
def __init__(self, name):
self.__name = name
def display(self):
print("Good Morning ", self.__name)
obj=Greeting('Bindu Madhavan')
obj.display()
एक पंक्ति में उत्तर
उत्तर
Good Morning BinduMadhavan
shaalaa.com
Sample Programs to Illustrate Classes and Objects
क्या इस प्रश्न या उत्तर में कोई त्रुटि है?
APPEARS IN
संबंधित प्रश्न
Which of the following is the output of the following program?
class Student:
def __init__(self, name):
self.name=name
print (self.name)
S=Student(“Tamil”)
What is the output of the following program?
class Sample:
__num = 10
def disp(self):
print(self.__num)
S = Sample()
S.disp()
print(S.__num)
Find the error in the following program to get the given output?
class Fruits:
def __init__(self, f1, f2):
self.f1=f1
self.f2=f2
def display(self):
print("Fruit 1 = %s, Fruit 2 = %s" %(self.f1, self.f2))
F = Fruits ('Apple', 'Mango')
del F.display
F.display()
Output
Fruit 1 = Apple, Fruit 2 = Mango