I have 4 classes in c++ . Animal is the super class were Snake and Tiger inherit from Animal but also inherit from Dangerous Animal . I have implemented a function to check if Snake or tiger is an instance of DangerousAnimal . However I am finding problems in implemting it in c++
my code is :
bool Vet::examine (Animal *someAnimal){
if(DangerousAnimal* s = dynamic_cast<DangerousAnimal*>(Animal)){
return false;
}else{
return true;
}
}
The error is
dillu24@dillu24-VirtualBox:~/Desktop/OOP/Lab1$ g++ -std=c++11 -oAnimalWellBeingLauncher AnimalWellBeingLauncher.cpp q1.cpp
q1.cpp: In member function ‘bool Vet::examine(Animal*)’:
q1.cpp:122:64: error: expected primary-expression before ‘)’ token
if(DangerousAnimal* s = dynamic_cast<DangerousAnimal*>(Animal)){