I cant find any documentation on how to create a custom class which inherits from SoftwareSerial - without the compiler complaining about the SoftwareSerial constructor not being a method of the custom class.....
Can someone please give me an example of .h and .cpp library code needed to get a custom class to inherit everything from SoftwareSerial??
Once i have a basic and working example, i can code in any extension i want. thanks
subclasses need to provide the same constructor/destructor signatures as the
superclass - otherwise instances of the subclass would not be type compatible with the
superclass. You are probably just failing to provide all of them.
C++ uses the awkward terms "derived class" and "base class" for subclass and superclass,
BTW.
Do i need to supply a constructor in my custom class, even though the constructor should be inherited from the SoftwareSerial class??
Does superclass refer to the class being inherited from - in this case SoftwareSerial? and
Does subclass refer to the custom class which receives the inherited methods/properties?
If your derived or inherited class is for your own use, fine.
However if you are planning something that will be distributed to others I wonder if it's safe to assume that the others will always have the correct version of SoftwareSerial from which your class should derive?
I would be inclined just to make a new complete class using the code from SoftwareSerial - after all it is open-source.
Maybe I'm being over cautious, but I see quite a few questions here which seem to arise because versions of libraries are not compatible with the version of the Arduino IDE.
PaulS:
Because versions of non-core libraries are out-of-date. SoftwareSerial is a core library.
Your comment is correct but I don't think it is relevant to the point I was trying to make. As far as I recall SoftwareSerial that is in IDE 1.05 is not the same as that which used to be in earlier versions of the IDE (I don't recall when it changed). If someone had written code that relied on working with the old version of SoftwareSerial it may not work with the current version (or a future version).
Of course it may be that the Arduino developers guarantee backward compatibility with the core libraries, in which case my concern is not relevant.