Yes, this is all clear. Joel
On Friday, September 25, 2015 at 11:56:46 AM UTC-4, Joel Andersson wrote:
>
> Hi,
>
> In C++ or in MATLAB I would use static member functions to keep the
> constructors nice and simple, e.g.
> class MyMatrix {
> public:
> static MyMatrix zeros(int n, int m);
> static MyMatrix ones(int n,
> In Julia, you can do the same thing, it is just spelled differently. You
> could do
x = zeros(MyMatrix, 3, 4)
where you have defined
Base.zeros(::Type{MyMatrix}, m, n) = .
Show trimmed content
Of course in Julia you can do anything you want.
However, is it recommended to
You probably know this, but the way dispatch works in Julia, it will look for a
function matching the signatures. Since, presumably, MyMatrix is not in base
Julia, that zeros function will do whatever you want it to do because you have
yo implement it.