Skip to content
Snippets Groups Projects
Commit f875e9ce authored by BiocheH's avatar BiocheH
Browse files

q3 : ajout de __str__

parent a337e325
No related branches found
No related tags found
No related merge requests found
......@@ -10,5 +10,11 @@ class TabletteChocolat:
self.m = m
self.n = n
def __str__(self):
return 'Tablette de chocolat de ' + str(self.m) + 'x' + str(self.n)
# __repr__ n'est pas surchargé car à priori dans notre cas __str__ suffit
A = TabletteChocolat(1, 2)
B = TabletteChocolat(1, 'ouioui')
B = TabletteChocolat(4, 8)
print(A)
print(B)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment