【发布时间】:2017-10-01 13:55:17
【问题描述】:
我不确定这是否可能,但基本上我有这个指针 typedef,它在我的线程之间共享的一个类中受到保护,我想创建一个返回该 typedef 指针的函数。
我可以毫无问题地在我的 .h 中声明该函数,但 .cpp 说它无法识别它。我也可以在函数中使用我的 typedef。我说的唯一我不能做的就是将它作为返回值。
我怀疑你们甚至必须看到代码,但我发布它只是为了让它完整。
共享标头:
#pragma once
class CR
{
public:
private:
public:
int c_outPut(std::string &output);
protected:
typedef std::unordered_map<in_addr, SOCKET>::const_iterator cit;
};
另一个.h的短版
#pragma once
#include "commonRec.h"
#include <unordered_map>
#include <WinSock2.h>
#include <iterator>
class CH : CR
{
std::string sendToCon(cit &const_it, const std::string &command);
cit findHost(std::string &searchHost);
};
.cpp 函数声明 - 错误“cit is undeclared identifier”
cit CC::_translateCommand(string &command)
{
}
【问题讨论】:
标签: c++ inheritance return-value typedef protected