[Главная] [чё-нить] [HELP!] [Написать!] [Залатая Барада] [Поиск] [Status] [Last|TMPT] [RSS|RSS-Last|LJ]

Дуро, , 2004-09-27 14:24:14
Previous Entry Add to memories! Next Entry
WTFdaily.com представляет:
Not quite getting that Object-polymorphism thing ...

Objects. Encapsulation of related fields and operations to make it easier to reuse and work with code. Easy enough!

Polymorphism. The ability to have objects behave in the same manner, through inheritance, interface, etc. Gotcha.

Now let's give this Object-Polymorphism thing a try ...

if(obj instanceof MMSNode) {
MMSNode node = (MMSNode)obj;
attribs = node.getAttribs();
}
else if(obj instanceof MMSPhysComp) {
MMSPhysComp physComp = (MMSPhysComp)obj;
attribs = physComp.getAttribs();
}
else if(obj instanceof MMSLogComp) {
MMSLogComp logComp = (MMSLogComp)obj;
attribs = logComp.getAttribs();
}
else if (obj instanceof MMSPhysLink) {
MMSPhysLink physLink = (MMSPhysLink)obj;
attribs = physLink.getAttribs();
}
[code discovered by David Shay]

Awww yeah, looks good to me! Just call me Mr. Object Oriented!

posted on Wednesday, September 08, 2004 12:34 PM


nant, , 2004-09-27 15:12:45 (скандирует)

Сцыл-ку, сцыл-ку!

Дуро, , 2004-09-27 15:32:07 http://thedailywtf.com/archive/2004/09/08/1609.aspx

Дуро, , 2004-09-27 15:34:20 там много чего :)

погромист, , 2022-01-12 03:53:27 фу, яваскриптеры


 Отметиться
[Главная] [чё-нить] [HELP!] [Написать!] [Залатая Барада] [Поиск] [Status] [Last|TMPT] [RSS|RSS-Last|LJ]


©2003-2005. Авторы двиШка: megath[aka dura], skupr , спасибо MakZ'у за пинки ;)
Также огромное спасибо всем, кто сюда что-то когда-то постил, и тем, кто постил тем, кто постил, а также - авторам )))

приколов.нет Байанометр СКОТОБАЗА АТАТАТ yaplakal.com