I have a structure which has a function with many methods.
struct shape
type :: Symbol
mtl :: String
t :: Real
A :: Float64
Asy :: Float64
Asz :: Float64
function shape(mtl::String,t::Real)
A = t*t;
Asy = (5/6)*A;
Asz = (5/6)*A;
return new(:square,mtl,t,A,Asy,Asz)
end
function shape(type::Symbol,mtl::String,t::Real)
A = t*t;
Asy = (5/6)*A;
Asz = (5/6)*A;
return new(type,mtl,t,A,Asy,Asz)
end
function shape(t::Real)
A = t*t;
Asy = (5/6)*A;
Asz = (5/6)*A;
return new(:square,"mtl",t,A,Asy,Asz)
end
end
Is there a way to group the methods?
i.e
struct shape
type :: Symbol
mtl :: String
t :: Real
A :: Float64
Asy :: Float64
Asz :: Float64
function shape(arg)
A = t*t;
Asy = (5/6)*A;
Asz = (5/6)*A;
return new(type,mtl,t,A,Asy,Asz)
end
end