This question already has an answer here:

I have a task implement OOP in wolfram mathematica. I think write class Point and inherit from it class Rectangle. In C# or C++ it's very easy, but I don't know how do it in wolfram mathematica. All books which I found I must pay for them. Can you advise some free books, or give examples how write and work wit classes. Tnanks,Maria.


marked as duplicate by gpap, ciao, Yves Klett, Kuba, Sjoerd C. de Vries Apr 29 '14 at 10:32

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • $\begingroup$ See here for some discussion, links, and references. $\endgroup$ – ciao Apr 29 '14 at 8:07
  • 1
    $\begingroup$ Just bear in mind that you might be letting yourself in for more than you expect. It's not just about how to write a class. First you have to write the entire OOP implementation, because Mathematica is not an object-oriented language. It can be done, but going down the OOP route might not be the easiest way to attain your goals, whatever they might be. $\endgroup$ – Oleksandr R. Apr 29 '14 at 12:49
  • 1
    $\begingroup$ I have implemented a version of OOP which I described here. In that post, I explained how it works and added a few examples you may find useful. My implementation is somewhat similar to Maeder's (although I did this independently, not based on his code), but IMO I have more idiomatic method calls, which allow usual Mathematica patterns and method overloading. OTOH, class field support currently is suboptimal, something I have to work on. $\endgroup$ – Leonid Shifrin Apr 29 '14 at 15:57

Browse other questions tagged or ask your own question.