Better HN
top
new
best
ask
show
jobs
Log in
Sign up
Better HN
Comment
by
glandium
· 4y ago · 0 comments
You can define a field with the type of the base class in the subclass, and impl Deref for SubClass, with Target = BaseClass.
Comments
[–]
cylon13
4y ago
You can, but the docs for Deref beg you not to use Deref for types that aren’t smart pointers because of how confusing and surprising the results can be to an unfamiliar reader of the code.