首先,我是编程的初学者,所以不要指望我理解每个特定于代码的单词。如何组织包括包含在C++中的多个类中
第二我有时在摄取缓慢。
第三我认为我涵盖了C++的基础知识,但就是这样。我很高兴当然学到更多!
我的问题:
我编写一些代码,带班体验。我做了两个类,每个类都有一个不同的.h和.cpp文件。现在每个人都使用标题iostream
和string
。
我应该如何包含那些没有任何问题?是否#pragma
曾经足够?
第二个问题是关于using namespace std
: 我应该在哪里把它(我知道这是不是一个坏的使用,但只北京时间对于小PROGRAMM)
第一个标题:
#pragma once
#include <iostream>
#include <string>
//using namespace std Nr.1
class one
{
};
第二高位:
#pragma once
#include <iostream>
#include <string>
//using namespace std Nr.2
class two
{
};
最后主营:
#include "one.h"
#include "two.h"
//using namespace std Nr.3
int main()
{
return 1;
};
预先感谢您的回复。
您需要提供(最小)示例代码。你的解释是不清楚究竟是什么问题 – Drop