Le 18/06/2012 15:29, Bruce a écrit :
> On Mon, 2012-06-18 at 22:39 +0930, Bruce wrote:
>
>> 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.
>>
>
> Let me rephrase that (sometimes the keyboard is quicker than the mind.)
>
> 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
>
>         Static Public Hello As String = "Hello from South Australia"
>
> Save and reload the project.
> In MMain.Main type the following:
>
>         ?appl[Enter].he
>
> ( see new! screenshot appended)
> Now that, to me, looks like we have successfully overridden the
> Application class, but look what happens when you run it.
>
>
> What you should see is a very correct error message saying that Hello
> is an unknown method in Application.  That is because it hasn't been exported.
> But when I go back and export the class, then I get the Multiple Inheritance 
> error.
>
> B
>

If you export a class with a name that already exists, it automatically 
implies inheritance with overriding.

So you have a "multiple inheritance" error by using the "Inherits" keyword.

-- 
Benoît Minisini



------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user

Reply via email to