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
double
and notfloat
. (Floating-point literals like2.0
are of typedouble
anyway.) The only time you should usefloat
is if you have either astruct
containing afloat
or an array offloat
and 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.