On Monday, June 02, 2014 02:32:28 PM Eric MSP Veith wrote:
> On Monday 02 June 2014 13:24:43, Roelof Wobben <r.wobben / home.nl> wrote:
> > Can anyone then give me a hint how to solve this by duck typing ?
> > I have read many pages about it but I still confuses me.
> 
> With "traditional" object-oriented programming, a class is also a data type.
> That meant: different class, different data type. If classes have the same
> ancestor or implement the same interface, they can be casted to that base
> class or interface. Basically, the common denominator. Whenever the method
> you want to call is defined in that base class/interface, you can call it,
> not matter what actual class you have.
> 
> Now, introduce duck typing. Duck typing has the popular slogan "If it walks
> like a duck, and quacks like a duck, I'll happily treat it as a duck." That
> means that there is no need for common base classes or interfaces any more.
> If classes A and B share the same method signature, you can call it on both
> classes, no matter what they otherwise do.
> 
Excellent answer. You helped me also a lot to understand this. :-)

-- 
================
Regards,
Arup Rakshit
================
Debugging is twice as hard as writing the code in the first place. Therefore, 
if you write the code as cleverly as possible, you are, by definition, not 
smart enough to debug it.

--Brian Kernighan