From e9c437b70e7fc2514a17f836543423d60c6706b9 Mon Sep 17 00:00:00 2001 From: un-oeil Date: Sun, 15 Nov 2026 12:00:16 +0100 Subject: [PATCH] Partie Composant chimique --- main.py | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index 8e23576..e3fcdb3 100644 --- a/main.py +++ b/main.py @@ -1 +1,22 @@ -print("Hello World") \ No newline at end of file +from abc import ABC, abstractmethod + +class ChemicalComponent(ABC): + + def __init__(self, name): + self._name = name + + @property + def name(self): + return self._name + + @abstractmethod + def mass(self): + pass + +class Atom(ChemicalComponent): + def __init__(self,name): + super().__init__(name) + + + def mass(self): + return "masse de l'atome" \ No newline at end of file