+ 2
(Solved)Why can't I implement abstract classes?
Hi I want to make an abstract class so that I don't have to write multiple identical methods. I want to treat 2 classes like the same. But the conpiler keeps on yelling at me that these abstract objects cannot point to derived classes. Why? https://code.sololearn.com/cg6CKSgoqoTE/?ref=app
2 ответов
+ 1
Otebay Stills
Your design looks Ok about abstract class hand and derived classes shorthand and longhand is correct.
The only flaw is that
Clock singleton class object is trying to access incorrect location
bob->minute->setminutes(32);
bob->minute++;
Second statement increment pointer variable to move next object location that doesn't exist.
(*bob->minute)++;
apart from this it needs to declare postfix
operator ++ (int);
and update related derived
operator ++ (int);
It will fix the code.
DHANANJAY PATEL
0
DHANANJAY PATEL OMG THANK YOU SO MUCH!!!!!!!! MAAAAN YOU ARE SO SMART