CPP04 1.0
|
Main entry point for C++ Module 04 Exercise 02. [詳解]
#include "Animal.hpp"
#include "Brain.hpp"
#include "Cat.hpp"
#include "Dog.hpp"
#include "ScopedPointer.hpp"
#include "WrongAnimal.hpp"
#include "WrongCat.hpp"
#include <cstdlib>
#include <iostream>
関数 | |
int | main () |
Main function to demonstrate abstract classes and polymorphism. | |
Main entry point for C++ Module 04 Exercise 02.
This file serves as a test driver to demonstrate the behavior of the Animal, Dog, Cat, WrongAnimal, WrongCat, and Brain classes after Animal has been made an abstract class. It verifies that Animal objects cannot be directly instantiated and that polymorphic behavior continues for derived concrete classes. It includes tests for deep copy and memory management.
main.cpp に定義があります。
int main | ( | ) |
Main function to demonstrate abstract classes and polymorphism.
Calls various static helper functions to showcase different aspects of the Animal hierarchy after Animal has been made abstract. An attempt to instantiate Animal directly will result in a compile-time error.