public class myClass
{
private string myProperty;
public myClass(string argInit) {
myProperty = argInit;
}
public myMethod(string arg1, int arg2) {
//do something
myProperty = arg1 + arg2.toString();
}
}The actor (process with Erlang) is:
myClass(myProperty) ->
receive
{myMethod, Arg1, Arg2 } ->
myClass(Arg1 ++ Arg2)
end.
And it's "constructor" is the spawn of process:
spawn( myClass, [argInit ]).
Thus, an object's method (OOP) is an actor's message. Like UML sequence diagrams.
No hay comentarios:
Publicar un comentario