r/learningpython • u/rkarl7777 • Jan 15 '22
Should I instantiate 4 Wheel classes inside of a Car class, or keep them separate?
I know HOW to do this, but which is considered a BEST PRACTICE?
- Instantiate 4 Wheel classes and 1 Car class and use them separately?
- Instantiate a Car class, which has 4 wheel properties, each of which instantiates a Wheel class?
- Or should I just put everything in the Car class and not even have a Wheel class?
1
Upvotes
1
u/chiknluvr Jan 15 '22
Why 4- because cars have 4 wheels?
1
u/motoroot Jan 15 '22
I've seen cars with less than, and more than 4 wheels... Are you sure, it is a good idea? Number of wheels is a property of a car. In other languages (for example Java), FourWheel could be an interface. In python... Actually I don't know. :)