我曾经将Visual Studio用作C ++的编译器。我最近在cygwin中使用g ++。我的问题是我不知道如何使用cygwin进行继承。下面的代码仅用于说明,使我的问题更加清楚。
基类:
// A.h:
class A{
void func1();
};
class B:A{
func2();
};
//-------------
//A.cpp:
#include"A.h";
A::func1(){
};
//-----------
//B.cpp:
#include"A.h";
B::func2(){
func1();
};
int main(){
B b.
b.func2();
return 0;}
//----------------
我在Visual Studio中运行(类似于)没有任何问题。但是我不知道如何在cygwin中运行它。如何在A.cpp中包含Ah,以便在B.cpp中运行main()。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句