I am not an expert in OOPS and or design patterns.
I have come across this situation: Is a car with a bumper sticker subclass of a car?
If not then how can I add dynamic properties to instance of an object? For example a car, a car with bumper sticker etc.
Not all cars come with a bumper sticker. One can add a bumper sticker and even more than one bumper sticker. I can not implement a sticker with car, afaik, implementing me will force me to add stickers. A bumper sticker on a car is one new property that came into existence after car (object?) was created.
You can use the Decorator Design Pattern for cases like this. It will allow you to “add dynamic properties to instance of an object” which is what you mentioned, you can add any amout of stickers or any other property, in all combinations possible by “decorating” your
carclass.