Override và Overload operator new/delete trong C++ để làm gì?

Vấn đề bạn đang nói liên quan đến một khái niệm gọi là “polymorphism” nghĩa là đa hình. Nói đại khái thế này: có một hàm ở lớp cha và bạn kế thừa từ lớp đó, nhưng ở lớp dẫn xuất bạn muốn khai triển hàm đó theo một cách khác dựa trên hàm có sẵn từ lớp cha để phục vụ cho mục đích gì đó, khi đó bạn sẽ sử dụng override(hay còn gọi là ghi đè) để định nghĩa lại hàm đó từ lớp cha sao cho phù hợp với mục đích của bạn ở lớp dẫn xuất.

 // C++ program for function overriding 
 #include <bits/stdc++.h>
using namespace std;
// Base class
class Parent
{
public:
void print()
{
    cout << "The Parent print function was called" << endl;
}
 };

 // Derived class
     class Child : public Parent
     {
public:     
// definition of a member function already present in Parent
void print()
{
    cout << "The child print function was called" << endl;
}   
};

 //main function
   int main() 
 {
     //object of parent class
 Parent obj1;
 
//object of child class
Child obj2;
 
 
// obj1 will call the print function in Parent
obj1.print();
 
// obj2 will override the print function in Parent
// and call the print function in Child
obj2.print();
return 0;
} 

Output:

The Parent print function was called
The child print function was called

Như bạn thấy ở đoạn code trên, thì hàm print đã được override hay ‘ghi đè’ lại ở lớp dẫn xuất của nó.
Nguồn tham khảo từ : http://www.geeksforgeeks.org/polymorphism-in-c/