Add inheritance/polymorphism support

See #48