How to inherit constructor in C++ class?

Red Squirrel

No Lifer
May 24, 2003
71,305
14,081
126
www.anyf.ca
I know I've done this before, I just can't remember how to do it with C++.

Basically I have two classes:
BaseHvacAction, and the constructor has one parameter: type uk1104Connector
FurnaceHA, and the constructor has type uk1104Connector and 2 ints.

I want the FurnaceHA constructor to just dump the value of the uk1104Connector into the base class.

This is my attempt, but it's not compiling. What is the proper syntax for this? I hope this makes sense.

Code:
FurnaceHA(uk1104Connector * con,int lowtemp,int hightemp) : BaseHvacAction(con);

Surprisingly, I'm not finding much on Google about this, but I don't really know what to search for. Keep in mind this is the .h file, the actual code will be in the .cpp file. I like to keep it separate.
 

Red Squirrel

No Lifer
May 24, 2003
71,305
14,081
126
www.anyf.ca
You want a member initialization list...

http://www.cprogramming.com/tutorial/initialization-lists-c++.html

But this is a private detail of the relationship between the derived and base classes, and further it is implementation. Thus it has to go in the .cpp where the constructor is defined, not in the header.

Thanks looks like I had it, but my mistake was I was putting it in the header. I declared it normally in the header and put the rest in the cpp and it works now.