added virtual decleration so that correct functions are called