Answer the question
In order to leave comments, you need to log in
I can’t understand the essence of the task with classes, am I generally doing the task correctly?
Create a class with two variables. Add a constructor with input parameters. Add a constructor that initializes the default members of the class. Add a destructor that displays a message about the deletion of the object.
class Class1:
def __init__(self, a=5, b=4):
self.a = a
self.b = b
print("Вызван метод __init__()")
def __del__(self):
print("Вызван метод __del__()")
c1 = Class1(1, 2)
c2 = Class1()
del c1
del c2
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question