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). But 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” – works just as in C#:


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


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


The RootClass.OnCreate
The RootClass.OnCreate
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 self.base.OnCreate 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 get 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 07:03, 15 March 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” – 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 get this output:

Base class - 4.png

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

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