Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

operator inheritance from a class template???

Status
Not open for further replies.

jmborr

Instructor
Feb 16, 2004
7
US
Hi all,
For some reason, my derived class does not inherit the operator '=' of my base class, which is a class template, when I compile with g++
//=========== base class
template<class T>
class vec{
public:
vec &operator=( vec ) ;
};
//=========== derived class
class vec_d : vec<double> {
};
//===========

When I compile, I have the following error:
no match for `vec_d& = vec<double>' operator
candidates are: vec_d& vec_d::eek:perator=(const vec_d&)

Any ideas, please???
jose,
 
Your problem is not related with class templates.

See thread:
thread116-733858

--
Globos
 
Wow, who could have imagined this?

I was puzzled because I had also defined operators '+', '+=&quot; and I had no complain with these ones.

Thank you for the huge help :)

jose
 
definition: operator = from base classes are not inherited.

Ion Filipski
1c.bmp
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top