C
Chris Mantoulidis
I have an abstract class BaseDate and have declared its functions as
pure virtual.
Then I have another class MathDate whose parent is BaseDate.
In base date I have this functions (among others):
virtual BaseDate * set_day(int) = 0;
I've got that function for month and year handling as well. I wanted
to have BaseDate & as a return type but I wasn't sure if I could
achieve polymorphism with a reference (can I?). Still even with a
reference my problem would be the same.
Since that function is virtual I have to use that declaration in the
deriving class, so I'm stuck with
BaseDate * set_day(int);
in my MathDate class. However I want the MathDate class to return
MathDate & (or MathDate * anyway). I would have used overloading but
since this class is for my practise with abstract classes I was
wondering if there was a way to solve my problem.
TIA,
cmad
pure virtual.
Then I have another class MathDate whose parent is BaseDate.
In base date I have this functions (among others):
virtual BaseDate * set_day(int) = 0;
I've got that function for month and year handling as well. I wanted
to have BaseDate & as a return type but I wasn't sure if I could
achieve polymorphism with a reference (can I?). Still even with a
reference my problem would be the same.
Since that function is virtual I have to use that declaration in the
deriving class, so I'm stuck with
BaseDate * set_day(int);
in my MathDate class. However I want the MathDate class to return
MathDate & (or MathDate * anyway). I would have used overloading but
since this class is for my practise with abstract classes I was
wondering if there was a way to solve my problem.
TIA,
cmad