5 ms·
Can you explain how inheritance makes more sense here? I don't see much practical difference between Circle/Path/etc. inheriting from base class Shape or implem
by deredede 4y ago
Can you explain how inheritance makes more sense here? I don't see much practical difference between Circle/Path/etc. inheriting from base class Shape or implementing trait Shape here.
The only difference is that AFAIK the languages you cite all have enough runtime information to allow downcasting, which in Rust one has to introduce manually (it is one of the solutions mentioned in the post).