declaring DallaTemperature objec in a class

Hello,
I don’t know how to declare one wire object and DallasTemperare in a *.h header class.
This is may be because there is no empty constructor.

Is anybody can send me an example how to put these 2 object in a class.
wich part to declare in the Header file and wich part in the cpp file.

Many thanks in advance !

Best regards
Thierry

This is may be because there is no empty constructor.

So, you have to create the DallasTemperare and OneWire objects at the same time as your constructor.

// Header
class crap
{
   private:
      OneWire one;
      DallasTemperare t;

      int mPin;

   public:
      crap(int pinToUse);
};

// Source
crap::crap(int pinToUse):one(whateverArgumentsItTakes), t(whatever)
{
   mPin = pinToUse;
}

Or, define pointers to the OneWire and DallasTemperare objects and create them in the sketch, passing them to the constructor.

Many thanks:

in the .h OneWire *oneWire; DallasTemperature *sensors;

in the cpp oneWire = new OneWire(ONE_WIRE_BUS ); sensors = new DallasTemperature(oneWire); sensors->begin();

Thank you !

Thierry