templated class : accessing derived normal-class methods
Posted
by
user1019129
on Stack Overflow
See other posts from Stack Overflow
or by user1019129
Published on 2012-09-08T02:32:52Z
Indexed on
2012/09/08
3:38 UTC
Read the original article
Hit count: 133
I have something like this :
class Container1 {
public:
method1() { ... }
}
class Container2 {
public:
method1() { ... }
}
template<class C = Container1>
class X : public C {
public:
using C::method1();
.....
X(string& str) : C(str) {};
X& other_method() { method1(); ...; }
}
My question is why I have to use "using C::method1()", to be able to access the method.. Most of answers I found is for the case where templated-class inhering templated-class. Normally they mention using "this->", but this does not seem to work in this case. Can I do something else shorter...
Also I'm suspecting the other error I'm getting is related to the same problem :
no match call for (X<Container1>) (<std::string&>)
© Stack Overflow or respective owner