|
|
|
|
|
by jstimpfle
3385 days ago
|
|
The examples you mention are very good examples where there is much less benefit in polymorphism (ADTs) than you think. For one, many implementations have actually different names (such as append/add/__setitem__ in python, or push_back/insert/operator[] in C++). For another, data structures are important for efficiency. It doesn't make sense to abstract those. You shouldn't use an array where a tree or hashmap is more efficient, etc. By contrast, look at how polymorphism in datastructures is actually done in C++, i.e. STL. That's not your typical OO approach. |
|