What is cast (-ing)?

I'm trying to (thoroughly ;)) understand the appended microflow, in which the function 'cast' is used. Can someone explain what that is doing (here)? (Preferably not (just) in technical language. ;)) Regards, Joris 
3 answers

Casting is splitting the object in different specializations. In your case student and teachers both are generalizations of account. With the casting action you split the account object in the specializations student and teacher.

On a side note: you can have a discussion if it would be better to have a one on one relation with account instead of a generalization. In the Mendix classes the opinion is that one has an account and not that one is an account.





Ha Ronald,

Thanks for your reply! However, I'm still a little confused: what do you mean by 'splitting'?  (The verb in my question has now changed. ;)) 

I understand that what happens is that depending on something (specialization), different things happen. However: 1) how does the program know of what kind (specialization) the object is, and 2) if it knows that, why would it still need to perform a cast (before actually doing something else, such as in this case committing)?

Regards, Joris


I tried to improve the documentation in https://docs.mendix.com/refguide/cast-object

Feel free to comment on my pull request https://github.com/mendix/docs/pull/827