0

Similar pattern working for resizing integer array, but not working for object array. Please review and help!

https://code.sololearn.com/cY8EdDg79cBo/#cpp

5th Nov 2020, 1:01 PM
S.K
4 Réponses
+ 1
Is there a reason why you can't use std::vector for this? And please choose one of the two threads you want to keep, I see you posted this earlier ... https://www.sololearn.com/Discuss/2577506/?ref=app (Edit) Duplicate removed
5th Nov 2020, 1:36 PM
Ipang
+ 1
A short review of your code tells me Line 7: <name> and <cms> field should be private. Line 12: Member function `addStudent` was declared to return `Student` object, but nothing is returned. Line 44: You are assigning a `Student` object from a class member function which doesn't return anything. You keep creating new array everytime a new `Student` object requires storage space. Once your `Student::addStudent` works, maybe you can look into C `realloc` function instead, as that one actually resize an allocated memory block.
5th Nov 2020, 2:08 PM
Ipang
0
deleted the other one. I don't want to use a vector. I need to clear this concept before jumping into the linked list.
5th Nov 2020, 1:54 PM
S.K
0
Nothing working 😔
5th Nov 2020, 6:24 PM
S.K