I found a way to avoid the copying involved in the super
method defined in the first post. Simply use invoke
.
The updated call(p::AbstractCitizen)
is now:
function call(p::AbstractCitizen)
if p.nationality == "Italian"
print_with_color(:red, uppercase(p.name), " dove sei ?")
elseif p.nationality == "UK"
print_with_color(:red, uppercase(p.name), " where are you ?")
else
invoke(call, Tuple{AbstractPerson}, p) # invoke method using parent object
end
end