// A program that illustrates the use of both the general Point template class // and the specialized Point template class. #include #include #include "point.cc" int main(){ Point pd1, pd2(1,2); Point pi1, pi2(3,4); Point pc1, // Using the template specialization. // The strange default constructor reveals the // use of the template specialization. pc2(97, 98); // Char 97 = 'a' pd2.move(1,1); pi2.move(1,1); pc2.move('r', 's'); // Absolute moving! std::cout << "pd2: " << pd2 << std::endl; // (2,3) std::cout << "pi2: " << pi2 << std::endl; // (4,5) std::cout << "pc1: " << pc1 << std::endl; // (a,z) !! std::cout << "pc2: " << pc2 << std::endl; // (r,s) std::cout << "|pd1 - pd2| = " << pd1.distance_to(pd2) << std::endl; // 3.60555 std::cout << "|pi1 - pi2| = " << pi1.distance_to(pi2) << std::endl; // 6.40312 std::cout << "|pc1 - pc2| = " << pc1.distance_to(pc2) << std::endl; // 7 std::cout << "|pd1 - pi2| = " << pd1.distance_to(pi2) << std::endl; // Error: No matching function for call // to 'Point::distance_to(Point&)' }