Calling base class
No edit summary
No edit summary
Line 1: Line 1:
EAL (Eco Action Language) is fantastic as it allows you to create a complete system without bringing out Visual Studio or C# at all (nothing is wrong with C# – but it is amazing to be able to execute the model alone). It had a limitation: when overriding methods, there was no way to call the base class implementation of the method.
EAL (Eco Action Language) is fantastic as it allows you to create a complete system without bringing out Visual Studio or C# at all (nothing is wrong with C# – but it is amazing to be able to execute the model alone). It had a limitation: when overriding methods, there was no way to call the base class implementation of the method.


Now that is fixed by introducing the EAL operation “base” – works just as in C#:
Now that is fixed by introducing the EAL operation “base” – it works just as in C#:


[[File:Base class - 1.png|frameless]]
[[File:Base class - 1.png|frameless]]
Line 15: Line 15:
[[File:Base class - 3.png|frameless|467x467px]]
[[File:Base class - 3.png|frameless|467x467px]]


Note the self.base.OnCreate call that calls the superclass implementation of OnCreate (just as in C#)
Note the <code>self.base.OnCreate</code> call that calls the superclass implementation of OnCreate (just as in C#)


And when creating a new Person, I get this output:
And when creating a new Person, I got this output:


[[File:Base class - 4.png|frameless]]
[[File:Base class - 4.png|frameless]]


…as in the RootClass added “RA ” and the Person added “PA”.
…as in the RootClass added “RA” and the Person added “PA.
[[Category:EAL]]
[[Category:EAL]]

Revision as of 05:28, 14 June 2023

EAL (Eco Action Language) is fantastic as it allows you to create a complete system without bringing out Visual Studio or C# at all (nothing is wrong with C# – but it is amazing to be able to execute the model alone). It had a limitation: when overriding methods, there was no way to call the base class implementation of the method.

Now that is fixed by introducing the EAL operation “base” – it works just as in C#:

Base class - 1.png

Given the OnCreate method (that is called when an object is created).

The RootClass.OnCreate

Base class - 2.png

And the Person.OnCreate

Base class - 3.png

Note the self.base.OnCreate call that calls the superclass implementation of OnCreate (just as in C#)

And when creating a new Person, I got this output:

Base class - 4.png

…as in the RootClass added “RA” and the Person added “PA.”

This page was edited 98 days ago on 02/10/2024. What links here