Welcome Guest, Not a member yet? Register   Sign In
Am I loading a class twice?
#13

[eluser]Buso[/eluser]
If a method wasn't declared static, and you call it statically, it may work.. or not. Or it may do something unexpected. Unless the method's docs says that it can be called statically, you shouldn't do that.
When a method is called statically, you are sending a message to the class, which knows nothing about the instance. If the method depends on an instance attribute to work, it will fail.

Suppose you have a class Car, and two instances of it, eg: a red car, and a yellow car.
And you call Car::get_color().. Which color should it return? It will fail, unless it was designed to be called statically.


Messages In This Thread
Am I loading a class twice? - by El Forum - 10-07-2010, 12:26 AM
Am I loading a class twice? - by El Forum - 10-07-2010, 12:38 AM
Am I loading a class twice? - by El Forum - 10-07-2010, 01:02 AM
Am I loading a class twice? - by El Forum - 10-07-2010, 01:12 AM
Am I loading a class twice? - by El Forum - 10-07-2010, 01:18 AM
Am I loading a class twice? - by El Forum - 10-07-2010, 01:37 AM
Am I loading a class twice? - by El Forum - 10-07-2010, 01:47 AM
Am I loading a class twice? - by El Forum - 10-07-2010, 02:00 AM
Am I loading a class twice? - by El Forum - 10-07-2010, 02:15 AM
Am I loading a class twice? - by El Forum - 10-07-2010, 02:28 AM
Am I loading a class twice? - by El Forum - 10-07-2010, 02:31 AM
Am I loading a class twice? - by El Forum - 10-07-2010, 02:36 AM
Am I loading a class twice? - by El Forum - 10-07-2010, 02:42 AM
Am I loading a class twice? - by El Forum - 10-07-2010, 02:47 AM
Am I loading a class twice? - by El Forum - 10-07-2010, 02:48 AM
Am I loading a class twice? - by El Forum - 10-07-2010, 02:54 AM
Am I loading a class twice? - by El Forum - 10-07-2010, 02:57 AM
Am I loading a class twice? - by El Forum - 10-07-2010, 03:01 AM



Theme © iAndrew 2016 - Forum software by © MyBB