Answers for "class python __call__"

0

class python __call__

#FROM GEEKSFORGEEKS <3
class Example:
    def __init__(self):
        print("Instance Created")
      
    # Defining __call__ method
    def __call__(self):
        print("Instance is called via special method")
  
# Instance created
e = Example()
  
# __call__ method will be called
e() #prints "Instance is called via special method"
Posted by: Guest on February-14-2022

Code answers related to "class python __call__"

Python Answers by Framework

Browse Popular Code Answers by Language