我在同一个.cpp上有两个类:
// forward
class B;
class A {
void doSomething(B * b) {
b->add();
}
};
class B {
void add() {
...
}
};
Run Code Online (Sandbox Code Playgroud)
前进不起作用,我无法编译.
我有这个错误:
error: member access into incomplete type 'B'
note: forward declaration of 'B'
Run Code Online (Sandbox Code Playgroud)
我正在使用clang编译器(clang-500.2.79).
我不想使用多个文件(.cpp和.hh),我想在一个.cpp上编码.
我不能在A班之前写B班.
你有什么想法解决我的问题吗?
最好的祝福.
我想按长度排序一个字符串,然后用ASCII顺序(大写和小写相等)用unix命令排序.
string = [a-z][A-Z][0-9]
Run Code Online (Sandbox Code Playgroud)
例如:
"A a b B cc ca cd" :
=> A a b B
=> ca cc cd
"Hello stackoverflow how are you today"
=> are how you
=> Hello today
=> stackoverflow
Run Code Online (Sandbox Code Playgroud)