int main() { Animal *animal = new Animal; Dog *dog = new Dog; GermanShepard *germanShepard= new GermanShepard; Cat *cat = new Cat; animal->getClass(); dog->getClass(); germanShepard->getClass(); cat->getClass(); whatClassAreYou(animal); whatClassAreYou(dog); whatClassAreYou(germanShepard); whatClassAreYou(cat); Dog spot; GermanShepard max; Cat mini; Animal* ptrDog = &spot; Animal* ptrGShepart = &max; Animal* ptrCat = &mini; ptrDog->getFamily(); ptrDog->getClass(); ptrGShepart->getFamily(); ptrGShepart->getClass(); ptrGShepart->makeSound(); ptrCat->getFamily(); ptrCat->getClass(); ptrCat->makeSound(); Animal* pCat = new Cat; Animal* pDog = new Dog; pCat->makeSound(); pDog->makeSound(); Car* stationWagon = new StationWagon(); stationWagon->getNumWheels(); cin.get(); return 0; }
int main() { Animal *pCat = new Cat; Animal *pDog = new Dog; pCat->makeSound(); pDog->makeSound(); Car *stationWagon = new StationWagon(); stationWagon->getNumWheels(); return(0); }
int main(){ Animal* pCat = new Cat; Animal* pDog = new Dog; pCat->makeSound(); pDog->makeSound(); // Create a StationWagon using the abstract data type Car Car* stationWagon = new StationWagon(); cout << stationWagon->getNumWheels() << endl; delete pCat; delete pDog; delete stationWagon; return 0; }