working functionality of inheritance