-2
Well I’m with an error in my 3 daughter classes(dvd,games,car) of a mother class calls video rental. I am trying to use the Factory method and generates the error in the new with the following message: invalid new-Expression of Abstract class type in the dvd in the game and in the car.
Produto* CriarNovoProduto(){
char letra;
do{
printf("QUAL PRODUTO?:\n");
printf("(J)OGO (C)ARRO (D)VD\n");
letra=getchar();
letra=tolower(letra);
}while(letra!='j' && letra!='c' && letra!= 'd');
switch(letra){
case 'j':
return new Jogo();
case 'c':
return new Carro();
case 'd':
return new Dvd();
default:
return NULL;
}
}
(I don’t know if I can post link with the full code but anyway: https://ideone.com/XLGAoI )