John Quach wrote:
I wonder, how come it works both ways with int and double but not with classes?
Maneesh Godbole wrote:
John Quach wrote:
I wonder, how come it works both ways with int and double but not with classes?
It might "work" but do you get the same value?![]()
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Bear Bibeault wrote:One reason:
Without the cast, you can't make the animal bark, because bark() is defined for just dogs, not all animals.
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors