
In this short instructional video, the speaker reviews a previously written Voiture class that declares two private attributes, couleur (initialized to "rouge") and vitesse (initialized to 0), and two public methods, accélérer (to increase speed) and afficherCompteur (to display the current speed). An instance named berline is created and its speed counter is displayed, showing 0 because the accélérer method has not been called. The speaker points out that initializing attributes directly in the class definition is poor practice in object‑oriented programming. Proper initialization should occur at object instantiation via a constructor. He demonstrates removing the inline initializations, leaving only attribute declarations, and explains that a constructor will automatically set the needed values when a new object is created.










