On Thursday, 14 November 2013 at 12:23:29 UTC, Jacob Carlborg
wrote:
On 2013-11-14 11:51, Paulo Pinto wrote:
Actually no different than using ADT (Abstract Data Types)
popularized
by modular languages like Modula-2, with the added benefit of
type
extension and polymorphism.
I had a look at this:
http://en.wikipedia.org/wiki/Abstract_data_type#Example:_implementation_of_the_stack_ADT
I don't see the difference compared to basic imperative
programming.
But OO is imperative programing at heart.
Picking the stack example you linked to, any ADT type that can
provide the stack_T operations can be used on its place.
Hence the added benefit OO offers of separating the ADT concept
of a stack, from its concrete implementation. This is the real
benefit over plain ADTs.
It has nothing to do with real physical objects, although it was
sold like that in the beginning, because it was easier for people
to understand it.
--
Paulo