On Friday, May 9, 2014 8:28:45 PM UTC-4, K leo wrote:
>
> I meant having the inner constructor but having no need to write the new
> statement. Isn't the purpose of the new statement implied by the
> constructor already?
>
No, because the variables "aa" and "bb" in your constructor are simply
local variables of your constructor function, and don't necessarily have
anything to do with the fields of the object being constructed. For
example, it would be perfectly valid to do:
type AA
aa
bb
function AA()
aa=1
bb=2
new(bb,aa)
end
end
I think you're getting confused by comparison to traditional OO languages
where methods are "owned" by the type and fields of the type are
automatically local variables of the type's methods. That's not the case
in Julia.