Error in TcpClient.cpp on line return m_ctx;
in method getConnection
: Use of undeclared identifier 'm_ctx'
Initable.h
#ifndef __L2P__Initable__
#define __L2P__Initable__
#include <iostream>
namespace l2 {
namespace utils {
template <typename CTX>
class Initable {
protected:
CTX m_ctx;
public:
void init(CTX ctx);
};
}
}
#endif /* defined(__L2P__Creatable__) */
TcpClient.h
#ifndef __L2P__TcpClient__
#define __L2P__TcpClient__
#include <iostream>
#include "../utils/Initable.h"
#include "TcpConnection.h"
namespace l2 {
namespace net {
template <typename CONN>
class TcpClient : public utils::Initable<CONN *> {
public:
CONN * getConnection();
virtual void init(CONN * ctx);
};
}
}
#endif /* defined(__L2P__TcpClient__) */
TcpClient.cpp
#include "TcpClient.h"
namespace l2 {
namespace net {
template <typename CONN>
CONN * TcpClient<CONN>::getConnection() {
return m_ctx;
}
template <typename CONN>
void TcpClient<CONN>::init(CONN * ctx) {
utils::Initable<CONN *>::init(ctx);
ctx->setClient(this);
}
}
}