You should really use double and not float. (Floating-point literals like 2.0 are of type double anyway.) The only time you should use float is if you have either a struct containing a float or an array of floatand you have a lot of them to the point where you really need to conserve memory.
In DerivedClass, you should really declare Display() like:
void Display() override
then it's obvious to both the compiler and the human reader that the function is overriding one in the base class. See here for more information.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
You should really use
doubleand notfloat. (Floating-point literals like2.0are of typedoubleanyway.) The only time you should usefloatis if you have either astructcontaining afloator an array offloatand you have a lot of them to the point where you really need to conserve memory.In
DerivedClass, you should really declareDisplay()like:then it's obvious to both the compiler and the human reader that the function is overriding one in the base class. See here for more information.