code showing working of inheritance