Hello,
few days ago I asked how to grant firend status to template. Thanks to
Rob Williscroft for his help. Now I have run into problems while using
class derived from the class created by the template. I'll try to give
part of code leaving out unnecesarry things.
---- base ----
template <typename T> class ptr_t;
class base_t {
template <typename T> class ptr_t;
int _ref_count; // how many "smart poiters" reference this instance
public:
base_t(void) : _ref_count(0) {};
}
template <typename T>
class ptr_t {
T *_target;
public:
ptr_t(void) : _target(NULL) {};
ptr_t(T *t);
ptr_t(ptr_t &other);
}
---- derived ----
class request_t: public base_t
{
// added members
}
class request_p: public ptr_t<request_t>
{
public:
bool operator==(const int) const;
bool operator==(const string &) const;
}
---- problem ----
When I use the following code:
request_p request(new request_t(number)); // <-- line ics.cc:146
it seems that the "ptr_t(T *t)" constructor is not inheried in
request_p.
ics.cc:146: no matching function for call to `request_p::request_p
(request_t *)'
request.hh:35: candidates are: request_p::request_p(const request_p &)
request.hh:35: request_p::request_p()
I think that none of the ptr_t constructors got inherited into request_p
as at request.hh:35 is only closing brace of request_p declaration and
the candidates are probably just default constructors suplied by
compiler.
What do I do wrong? How should the declaration fo request_p look like?
Thanks in advance Ales