Yes, if no inner constructor is provided, the default constructor is based
on fields. So

type AA
  aa::Int
  bb::Float64
end

is valid (and common).


On Fri, May 9, 2014 at 2:32 PM, cnbiz850 <[email protected]> wrote:

> As in the following example, new(aa,bb) is very redundant from coding
> point of view.  Since all fields are already declared and listed in the
> type definition, is it possible not to list them again with the "new"
> statement?  The new statement can be very troublesome when the type has
> many fields.
>
> =========
> type AA
>     aa
>     bb
>
>     function AA()
>         aa=1
>         bb=2
>         new(aa,bb)
>     end
> end
>

Reply via email to