接触到一个需要用到c++的小问题,现在我想使用a.h里面的纯虚函数fun1,它的实现方式在a_p.cc文件中,我想在test.cpp中调用这个函数,那我应该怎么调用呢,感谢感谢[抱拳]
a.h :
namespace Name {
class Pre {
public:
virtual void fun1() = 0;
}
}
a_p.cc:
#include <a.h>
namespace Name {
class CPUPre : public Pre {
protected:
void fun1() override {
cout << "get" ;
}
}
}
test,cpp:
#include <a.h>
int main{
}
a.h :
namespace Name {
class Pre {
public:
virtual void fun1() = 0;
}
}
a_p.cc:
#include <a.h>
namespace Name {
class CPUPre : public Pre {
protected:
void fun1() override {
cout << "get" ;
}
}
}
test,cpp:
#include <a.h>
int main{
}