【发布时间】:2012-10-05 05:03:00
【问题描述】:
我是新手,想了解更多关于如何将我的 C++ 文件拆分为 .h 和 .cpp 的信息
这是我的 File2.cpp
#include <iostream>
#include <string>
using namespace std;
class ClassTwo
{
private:
string myType;
public:
void setType(string);
string getType();
};
void ClassTwo::setType(string sType)
{
myType = sType;
}
void ClassTwo::getType(float fVal)
{
return myType;
}
我想把它分成 2 个文件,即 .h 和 .cpp 我如何将其拆分为一个类,私有和公共。
我想在 File1.cpp(另一个 cpp 文件)中使用 ClassTwo
如何链接它以便在 ClassTwo 中使用它
感谢您的帮助。
【问题讨论】:
标签: c++