我不知道如何将某些类分为.hpp和.cpp文件。您能告诉我如何划分以下示例类吗?
.hpp
.cpp
class Foo { public: int x; int getX() { return x; } Foo(int x) : x(x) {} };
以及如何在main函数中包含此类?
main
c++ class
c++ ×1
class ×1