You are viewing a single comment's thread from:

RE: Dev Diary 01 - Let's Talk About The Strategy Pattern

in #designpatterns2 years ago

This is not really a problem (you can define an attribute tires in the superclass - if all objects have wheels at all ;-) - and initialize it in the constructor of the child class with the appropriate number :-) ).

Ahh... I see where I messed up here. I meant to include things like ships over here and went with trucks. Error on my part. But, you get the point I tried to make.

With respect to overloading, I'd need different parameters in each overload. In the case of vehicles, if we are talking about tires, the overload would always be an integer and we cannot differentiate with that.

The encapsulation in an answer class is a good idea!

Totally! The mistake I made was I never went through the entire documentation initially and used the endpoints as and when I needed them. Now, going back and redoing those are a pain in the butt😅 But, that's something I will need to eventually get to anyways.

Coin Marketplace

STEEM 0.18
TRX 0.13
JST 0.029
BTC 57646.26
ETH 3029.18
USDT 1.00
SBD 2.26