C ++ - 2类1文件 [英] C++ - 2 classes 1 file
本文介绍了C ++ - 2类1文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
假设我想要这样的东西,在 .cpp
源文件中:
Suppose I want something of this sort, in one .cpp
source file:
class A {
public:
void doSomething(B *b) {};
};
class B {
public:
void doSomething(A *a) {};
};
有没有把它拆分成两个单独的文件,没有收到编译器错误语法错误 doSomething(B * b)
)
Is there anyway of doing this without splitting it into two separate files, and without receiving a compiler error (syntax error on doSomething(B *b)
)
推荐答案
第一行:
class B;
这篇关于C ++ - 2类1文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文