Content deleted Content added
m Use sentence case for headings per MOS:HEADINGS |
I've added the releasing of allocated heap memory using the "new" with its corresponding "delete" operator. Otherwise, memory leaks would happen. |
||
Line 410:
public:
STUDENT ( const char *name );
~STUDENT();
GRADE *grade;
};
Line 430 ⟶ 431:
// Nothing else to do.
// -------------------
}
STUDENT::~STUDENT()
{
// deallocate grade's memory
// to avoid memory leaks.
// -------------------------------------------------
delete this->grade;
}
</syntaxhighlight>
Line 452 ⟶ 461:
<< student->grade->numeric
<< "\n";
// deallocate sutdent's memory
// to avoid memory leaks.
// -------------------------------------------------
delete student;
return 0;
}
|