The processWolf
function takes a Wolf
argument, so you have to pass a Wolf
. Since both structures have Wolf
embedded in them, you can do:
processWolf(porthos.Wolf)
processWolf(aussie.Wolf)
because when you embed Wolf
into Dog
, Dog
gets all the methods Wolf
has, plus Dog
has a member called Wolf
.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…