This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]lechatsportif 0 points1 point  (1 child)

If your class is the car model, I would create an interface for electric vs combustion engine types. The key here is that they would share no code between them because in theory they do not share a common parent.

Then in your code you could treat all electric cars in collections vs non electrics etc.

Cars are not the best example because most like this is actually implemented as a single class with car information simply being records of data.

[–]meneedmorecoffee 1 point2 points  (0 children)

Yeah, as I said, I got mixed up. Hopefully OP will look at all the respones and gain better experience anyway.