metaprogramming/conditional-declaration/prog2.cc - Use of class Point | Lecture 6 - slide 36 : 40 Program 4 |
// Does not compiles, because int (in Point<int>) is NOT a floating point type. #include <iostream> #include <string> #include "point.cc" int main(){ Point<int> p1, p2(1,2); p1.move(1,1); // error: class Point<int> has no member named move p2.move(2,2); // error: class Point<int> has no member named move std::cout << "p1: " << p1 << std::endl; // (1,1) std::cout << "p2: " << p2 << std::endl; // (3,4) }