add destructor and inheritance