This is my first post on this forum and I have no formal training on C. I have used Dallas Temperature sensors for a number of projects and have been helping out with projects with some friends. I wanted to make a very simple library for the DS18B20 sensor that made it bit easier to use. I have made up this library which works but its coding is not what I had wanted. The library with example code can be gotten here. http://www.hayriv.com/arduino/ds18b20-library
My intent was to have a constructor that could be fed a pin number. The library would create an instance of the OneWire class then an instance of the Dallas Temperature class and then begin() the Dallas Temperature instance. Functions are provided to read the temperature in C or F. None of the other features are implemented.
My attempts to make an instance of OneWire and DallasTemperature classes in the constructor and save them for use later failed. That is now done each time the temperature is read. I believe I was able to save a pointer to the OneWire class but was unable to even create a global variable for the DallasTemperature class.
Any pointers or advise would be appreciated. I have done some programming in Java. In Java I would have extended the DallasTemperature class and then had easy access to all the methods/functions in that class. It looks like C++ can inherit from multiple classes. Would this work better if it inherited from both the OneWire and DallasTemperature classes?