I noticed from this answer that there's two ways of separating Contract code with state variables: Inheritance (class Contract is XY {}) or Reference (otherClass = new OtherClass())
I'm wondering what are the pros/cons of using one over the other.
In my mind, I expect initialising a new Contract()
to be more expensive since it sounds like it's deploying; yet in that answer, he explains that all the contracts compile down to one in the end, so perhaps it is not more/less expensive.
So why would you choose one over the other?