From: Mason Freed on 8 Apr 2010 19:40 I'm implementing a fairly common pattern, where I have a static method on the class that actually constructs objects of the class. The user is not intended to call the constructor directly, but instead to call the static method. Therefore, I have marked the class constructor as private. Okay, great. Except that many internal Matlab functions call class constructors with an empty argument list. E.g. foo=[] foo(5)=MyClass.GetClassObject(); % <-- this call will call the empty MyClass constructor 4 times, for elements 1-4. How can I implement the equivalent of two versions of the constructor, one for the parameter-less call from Matlab (which is public) and the other for use by the static factory method (which is private)? Most other standard OO languages have such a method overloading feature. How do I do it in Matlab? Help! Thanks, Mason
|
Pages: 1 Prev: NI-DAQmx TaskHandle mex file -> matlab Next: Registering CT images |