+ 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

21st Jul 2021, 9:31 AM
Purple Requiem
Purple Requiem - avatar
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
23rd Jul 2021, 3:13 AM
DHANANJAY PATEL
DHANANJAY PATEL - avatar
0
DHANANJAY PATEL OMG THANK YOU SO MUCH!!!!!!!! MAAAAN YOU ARE SO SMART
23rd Jul 2021, 7:41 AM
Purple Requiem
Purple Requiem - avatar