I get a weird response from my c++ compiler. I searched the internet but came up with nothing usefull or helpfull...
Compiler Response:
In constructor `HexFloatingPoint::HexFloatingPoint(int, int)':
floating.cpp|line 5|error: no matching function for call to `FloatingPoint::FloatingPoint()'
floating.hpp|line 16|note: candidates are: FloatingPoint::FloatingPoint(const FloatingPoint&)
floating.cpp|line 3|note: FloatingPoint::FloatingPoint(int, int)
Once you provide any constructor for your class you also have to explicitly provide a constructor which does not take any parameters if your code invokes the no argument constructor.
The warning clearly tells you that your code invokes a no argument constructor when it calls the constructor for:
HexFloatingPoint(int, int)
So either:
You should use member initializer list and invoke the desired version of constructor from base class if you don't want to provide a default no argument constructor for the base class.
floating.hpp|line 29|warning: `class HexFloatingPoint' has virtual functions but non-virtual destructor
This is an important warning. Your class HexFloatingPoint
has an virtual
member function which implies that it should also provide an virtual
destructor.
Note that if you do not provide a virtual destructor in your base class and you call delete
on a base class pointer pointing to a derived class object then it will result in Undefined Behavior.