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?
On 05/10/2014 03:45 AM, Isaiah Norton wrote:
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]
<mailto:[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