[Gambas-user] More on overriding native classes

Bruce bbruen at ...2308...
Mon Jun 18 15:09:54 CEST 2012


The previous topic has reminded me of something.

Contrary to what is said or implied in section 3.2 of the "Object Model"
help topic, it is not possible to override several if not many native
classes.

Two particular instances leap to mind, "Application" and "Error".

Try this:
Create a new command line project in the IDE.
Add a new class "Application" with the following contents

        ' Gambas class file
        
        Create Static
        Inherits Application
        Export
        
        Static Public Hello As String = "Hello from South Australia"
        
Save and reload the project.
In MMain.Main type the following:

        ?appl[Enter].he

( see screenshot appended)
Now that, to me, looks like we have successfully overridden the
Application class, but look what happens when you run it.

Similar things happen with Error and Class. Probably more.

To keep this one short, why would I want to override Application?
So I can get at more of what is in the .project file, sort of more
"introspection" than is currently there.

Any thoughts or comments?  (This is a discussion post, not a bug. That
is unless I've got it totally worng agian. Which given my recent strike
rate could be a possibility.)

Bruce
-------------- next part --------------
A non-text attachment was scrubbed...
Name: shot3.png
Type: image/png
Size: 16209 bytes
Desc: not available
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20120618/3162b4be/attachment.png>


More information about the User mailing list