Overriding Built In Methods

I see that I can override, for example, Window.Show by simply adding the method .Show to my Window class. Is it OK to do this?

And, is there a way within the method to call the original function so that my Show method looks like

… Do stuff…
self.show // for real. No recursion please.

Window.Show is just an example. I’m curious in general about this.

(Writing this before I’m properly awake, so this may contain big errors)

There are generally two ways to access methods & properties of a superclass:

  • the Super keyword, e.g.
  • casting the object to an instance of the superclass

Note that the rules regarding which to use in which situation is a bit complicated, I believe the right answer depends on whether the Method or Property is “virtual” or not. http://en.wikipedia.org/wiki/Virtual_function

Also, a second complication is that Windows are actually internally implemented as a Module, not a Class.

Actually, the shadowing issue only applies to properties. Overriding a method is perfectly fine.

Thanks Joe and Michael

If Super.ABC works, then you’re dealing with a method and you’re fine. If it doesn’t work (doesn’t compile), then you’re actually shadowing a property and should rethink your approach.

Well, the link to it sure works but I wouldn’t go there on a work machine. :stuck_out_tongue:

Wow. And here I thought that .XXX hadn’t yet been approved as a top-level domain.

On a related note, EsoTalk’s automatic link feature needs serious work.

Why does it need to be automatic? We have the ability to make links when appropriate.

I agree. But if it’s going to be automatic then it needs to be harder to trigger.

Oh Lord. Can that auto link feature please be disabled?

Lol - I just saw it. Best link to Xojo documentation so far :smiley:

I‘m grinning from ear to ear :smiley:

Thanks Tim! Made my day :wink:

Links edited :slight_smile:

FWIW the auto-link system is where I got the idea to snag Xojo.io :slight_smile:

BOOO! Spoilsport! Now it’s not funny anymore …

I really hate this nanny-state attitude … it‘s ok for Americans to have Horror and War, Weapons are glorified, but God forbid there is the suggestion of a nipple involved …

Personally, I agree. But, the Xojo forum is not the place for that.

Not a place for fun? An edit could simply have been to replace the dot with a comma, then the fun would have been preserved without the danger of accidently following the link.

P.S. or maybe put the dot in italics? Must see if that works: xojo.com

P.P.S. Yes, that works to disable a link.

Not a place for the airing political grievances, or pornography for that matter.

Who’s airing pornography??? [where is that rolling eyes smiley when you need it]

Maybe you should read properly before accusing anyone? Just a thought …

I assumed you were talking about the link that was edited from “super.xxx”, which is was a porn site. Please excuse my confusion; could you clarify what you were referring to?