Computer Science, asked by KYuvaganeshRemo3490, 1 year ago

Python desgin a class complex for adding two complex number and also show use of constructor

Answers

Answered by Geekydude121
0
class MyClass: "This is my second class" a = 10 def func(self): print('Hello')
# Output: 10print(MyClass.a)
# Output: <function MyClass.func at 0x0000000003079BF8>print(MyClass.func)
# Output: 'This is my second class'print(MyClass.__doc__)

class MyClass: "This is my second class" a = 10 def func(self): print('Hello')
# create a new MyClassob = MyClass()
# Output: <function MyClass.func at 0x000000000335B0D0>print(MyClass.func)
# Output: <bound method MyClass.func of <__main__.MyClass object at 0x000000000332DEF0>>print(ob.func)
# Calling function func()# Output: Helloob.func()

Similar questions