<分区>
所以我在main中定义了一个函数,我想在一个类中重用同一个函数...所以我不得不在类中重新创建它。我的问题是,有没有一种方法可以从 main 调用该函数,而不必将其复制并粘贴到类中......?
主要.cpp
#include "array_class.h"
#include "stack_class.h"
#include "queue_class.h"
using namespace std;
void displayText (std::string text, int sleepTime);
int main(){
}
现在我打算在 array_class 中调用 displayText