reused code with inheritance