Hi guys
I am trying to do the following:
abstract type Operator end;
mutable struct Multiply <: Operator
multiplier::Float64
end
mutable struct Incrementor <: Operator
inc::Int
end
mutable struct CompositeOp <:Operator
mulr::Multiplier
incr::Incrementor
end
c = CompositeOp(Multiply(2.2), Incrementor(3))
I want
c.multiplier
c.inc
to return 2.2 and 3 respectively and when i make an assignment to those the values in mulr and incr to change accordingly .how can i do something like this using setfield!, getfield and maps?
Or another solution is welcome.
Thanks