templates and  inheritance