编译器报错: test.h:20: warning: inline function `float Point2D::get_x() const' used but neve r defined g++ -O3 -o main test.o test_main.o test_main.o:test_main.cpp:(.text+0x13f): undefined reference to `Point2D::get_x( ) const'
[解决办法] We can specify that a member is inline as part of its declaration inside the class body. Alternatively, we can specify inline on the function definition that appears outside the class body. It is legal to specify inline both on the declaration and definition. One advantage of defining inline functions outside the class is that it can make the class easier to read.