Hello,
I am getting confused by generics. Please ignore the really bad design of the code below, it's just for test purposes.
Basically, I am a bit confused here - I know you can specify more than one type in the class definition, but what if you want your variable to be able to be more than one type?
For example, what if I want to be able to put either a phone or a comb in my bag, how can I do this? I have tried the below, but I seem to be doing it all wrong.
Thanks.
I am getting confused by generics. Please ignore the really bad design of the code below, it's just for test purposes.
Basically, I am a bit confused here - I know you can specify more than one type in the class definition, but what if you want your variable to be able to be more than one type?
For example, what if I want to be able to put either a phone or a comb in my bag, how can I do this? I have tried the below, but I seem to be doing it all wrong.
Thanks.