Click here to Skip to main content
15,884,473 members

The Weird and The Wonderful

   

The Weird and The Wonderful forum is a place to post Coding Horrors, Worst Practices, and the occasional flash of brilliance.

We all come across code that simply boggles the mind. Lazy kludges, embarrassing mistakes, horrid workarounds and developers just not quite getting it. And then somedays we come across - or write - the truly sublime.

Post your Best, your worst, and your most interesting. But please - no programming questions . This forum is purely for amusement and discussions on code snippets. All actual programming questions will be removed.

 
GeneralRe: What is an Object Pin
Marc Clifton17-Nov-13 4:51
mvaMarc Clifton17-Nov-13 4:51 
GeneralRe: What is an Object Pin
Member 1008817117-Nov-13 18:31
Member 1008817117-Nov-13 18:31 
GeneralRe: What is an Object Pin
Marc Clifton18-Nov-13 2:49
mvaMarc Clifton18-Nov-13 2:49 
GeneralRe: What is an Object Pin
Member 1008817118-Nov-13 6:26
Member 1008817118-Nov-13 6:26 
GeneralRe: What is an Object Pin
robocodeboy18-Nov-13 23:36
robocodeboy18-Nov-13 23:36 
GeneralRe: What is an Object Pin
Rob Grainger28-Nov-13 22:39
Rob Grainger28-Nov-13 22:39 
GeneralRe: What is an Object Pin
robocodeboy2-Dec-13 0:53
robocodeboy2-Dec-13 0:53 
GeneralRe: What is an Object Pin
Rob Grainger2-Dec-13 2:23
Rob Grainger2-Dec-13 2:23 
Not at all.

A normal method of a class (an instance method) has a hidden "this" parameter passed at run time. Any virtual methods defined on the class use "this" to provide access to the vtable, used to resolve virtual methods.

In contrast, a static method has no "this" parameter at all, it does not get passed a reference to the class object. In this sense, they are exactly analogous in the way they are implemented to global variables and functions. The only (slight) benefit offered is a degree of encapsulation.

C#, C++ and Java do resolve virtual methods dynamically, by looking them up in a vtable at run time. That is the definition of polymorphism.
Its not as dynamic as message resolution in dynamic languages, but its all they offer.

Gilad Bracha (one of the people who defined the JVM) is eminently more qualified than me to point out the issues with this, and has done so eloquently over at Room 101[^].
"If you don't fail at least 90 percent of the time, you're not aiming high enough."
Alan Kay.

GeneralRe: What is an Object Pin
robocodeboy2-Dec-13 2:38
robocodeboy2-Dec-13 2:38 
GeneralRe: What is an Object Pin
Rob Grainger2-Dec-13 4:14
Rob Grainger2-Dec-13 4:14 
GeneralRe: What is an Object Pin
robocodeboy2-Dec-13 4:30
robocodeboy2-Dec-13 4:30 
GeneralRe: What is an Object Pin
michaelbarb2-Dec-13 8:11
michaelbarb2-Dec-13 8:11 
GeneralRe: What is an Object Pin
Rob Grainger28-Nov-13 4:35
Rob Grainger28-Nov-13 4:35 
GeneralRe: What is an Object Pin
michaelbarb28-Nov-13 12:55
michaelbarb28-Nov-13 12:55 
GeneralRe: What is an Object Pin
Rob Grainger28-Nov-13 22:35
Rob Grainger28-Nov-13 22:35 
GeneralRe: What is an Object Pin
michaelbarb29-Nov-13 2:40
michaelbarb29-Nov-13 2:40 
GeneralRe: What is an Object Pin
Rob Grainger2-Dec-13 2:35
Rob Grainger2-Dec-13 2:35 
GeneralRe: What is an Object Pin
michaelbarb2-Dec-13 8:00
michaelbarb2-Dec-13 8:00 
GeneralRe: What is an Object Pin
Rob Grainger2-Dec-13 8:36
Rob Grainger2-Dec-13 8:36 
GeneralRe: What is an Object Pin
michaelbarb2-Dec-13 9:26
michaelbarb2-Dec-13 9:26 
GeneralRe: What is an Object Pin
Rob Grainger2-Dec-13 10:01
Rob Grainger2-Dec-13 10:01 
GeneralIf in doubt: cast, cast and cast again Pin
Mardy Git14-Nov-13 7:05
Mardy Git14-Nov-13 7:05 
GeneralRe: If in doubt: cast, cast and cast again Pin
PIEBALDconsult14-Nov-13 9:06
mvePIEBALDconsult14-Nov-13 9:06 
AnswerRe: If in doubt: cast, cast and cast again Pin
Mardy Git14-Nov-13 19:40
Mardy Git14-Nov-13 19:40 
GeneralRe: If in doubt: cast, cast and cast again Pin
ZurdoDev15-Nov-13 8:02
professionalZurdoDev15-Nov-13 8:02 

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

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