From f875e9ce2500226b25a216c4a9c323fbc375e76d Mon Sep 17 00:00:00 2001
From: BiocheH <quentin.hartman13@gmail.com>
Date: Fri, 10 Jan 2025 13:15:29 +0100
Subject: [PATCH] q3 : ajout de __str__

---
 main.py | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/main.py b/main.py
index 8016ced..30f0de8 100644
--- a/main.py
+++ b/main.py
@@ -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)
-- 
GitLab