Click here to Skip to main content

Welcome to the Lounge


For lazing about and discussing anything in a software developer's life that takes your fancy.
The Lounge is rated PG. If you're about to post something you wouldn't want your kid sister to read then don't post it. No flame wars, no abusive conduct and please don't post ads.

Technical discussions are welcome, but if you need specific help please use the programming forums.

GeneralRe: MQOTD PinprotectorOriginalGriff5-Jan-14 22:06 
GeneralRe: MQOTD PinprofessionalCBadger6-Jan-14 0:01 
GeneralRe: MQOTD Pinprofessionaldjj556-Jan-14 2:52 
GeneralDuck typing [modified] PinprofessionalMarco Bertschi5-Jan-14 20:43 
In computer programming with object-oriented programming languages, duck typing is a style of typing in which an object's methods and properties determine the valid semantics, rather than its inheritance from a particular class or implementation of a specific interface.

An interesting read, but something remains unclear to me: Why would you want to have something like
class Duck
  public void Quack() { ... }
  public void Walk() { ... }
class OtherDuck
  public void Quack() { ... }
  public void Walk() { ... }
void M(Duck bird)
M(new Duck()); // Legal
M(new OtherDuck()); // Illegal
rather than have and inherit from an interface ?
To me Duck Typing seems some [to be]* form of Duct Taping (I'll admit it: Pun intended).
* Fixed Typo - I forgot 'to be' in there.
Veni, vidi, caecus | Everything summarizes to Assembly code

modified 6-Jan-14 3:55am.

GeneralRe: Duck typing PinprofessionalKornfeld Eliyahu Peter5-Jan-14 21:11 
GeneralRe: Duck typing PinprofessionalNagy Vilmos5-Jan-14 21:40 
GeneralRe: Duck typing PinprofessionalCBadger5-Jan-14 21:40 
GeneralRe: Duck typing PinmemberBillWoodruff5-Jan-14 21:57 
GeneralRe: Duck typing PinmemberGjeltema6-Jan-14 4:13 
AnswerRe: Duck typing PinmemberPablo Aliskevicius5-Jan-14 22:58 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Advertise | Privacy | Mobile
Web04 | 2.8.140709.1 | Last Updated 10 Jul 2014
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid