[Scilab-Dev] Object Orientation

Amanda Osvaldo lambdasoftware at yahoo.es
Sun Feb 19 00:58:23 CET 2017


Hi everybody, i'm implementing object orientation in SciLAB, begin for
inheritance, encapsulation, and aggregation.

With a syntax like:

class GeometricHandle

public attribute = 5;

public function calc(x)
return x = x * attribute;
endfunction


endclass

instance = GeometricHandle();
instance.calc(10);

-->
I'm searching for inspiration in Struct DataType. I believe I can use
it as a base.

So, I need to ask.

What prevents me to insert a function inside a struct ?

Like someting: 

instance = struct();

instance.attribute = 5;
instance.calc = function(x) return x = x * attribute; endfunction;

Because of what i understood, in the Scilab's  core the  struct
datatype uses a class named SingleStruct , which in turn,  uses the
class InternalType to handle the struct's content.

And the class InternalType can handle functions.

If someone has a better idea I would like to listen.

-- Amanda Osvaldo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/dev/attachments/20170218/08b42b8a/attachment.htm>


More information about the dev mailing list