#include "ClassA.h" #include int main() { ClassA a; a.Print(); ClassA* pA = nullptr; pA = new ClassA(); pA->Print(); // (*pA).Print(); // same as above, but more complex to write delete pA; pA = nullptr; a.CompareTo(pA); IComparable* pComparable = nullptr; pComparable = new ClassA(); pComparable->CompareTo(&a); // pA = dynamic_cast(pComparable); // if (pA != nullptr) { // pA->Print(); // } delete pComparable; pComparable = nullptr; ClassA a2 = a; std::list l; l.push_back(a); l.push_back(a2); l.push_back(*pA); for (std::list::iterator it = l.begin(); it != l.end(); ++it) { // (*it).Print(); it->Print(); // same as line above, but simpler } return 0; }