How to call a base class's constructor? [Solved]

I have a relay class :

#ifndef RelayController_H
#define RelayController_H

#include "Arduino.h"

class RelayController{  
public:

  RelayController(int _pin);
  void setState(boolean venting);
  boolean getState();
};

#endif

…which I want to inherit into various classes e.g.

#include <RelayController.h>
class VentController : public RelayController{

public:
        VentController(int _pin) : RelayController(int _pin){}

};

I am trying (in VentController) to tell the compiler that the VentController constructor is the same as the RelayController constructor (should use the same constructor argument) as I thought I had understood the syntax from googling about… but I am at a bit of a loss here as to what’s going on.

The compiler error I’m getting is :

/Users/.../Arduino/libraries/.../VentController.h: In constructor 'VentController::VentController(int)':
/Users/.../Arduino/libraries/.../VentController.h:5: error: expected primary-expression before 'int'

Does anybody know how to do this?!?!?

I think you're supposed to get rid of the "int" in the RelayController call.

VentController(int _pin) : RelayController(_pin){}

Yes! That was it! I would never have thought of/noticed that. Seems counterintuitive. Many thanks!!!

bensenior:
Seems counterintuitive.

It shouldn't be, once you realise that you need to specify the type when you declare the interface to a function/method, but not when you invoke a function/method. The code VentController(int _pin) defines a constructor for the VentController class which takes an argument of type int which you're naming _pin; it declares the signature of the constructor. The code RelayController(_pin) invokes the RelayController constructor with an int argument, passing _pin as the argument value.