July 2000
Intermediate to advanced
1280 pages
34h 55m
English
In this section, I compare the use of operators new and delete with the use of functions malloc() and free(). Similar to the previous section, you can skip this section if you feel it is too technical. Make sure you come back to this section for two things: a) the recommendation to use new and delete over malloc() and free(), and b) the criticism of my example for not abiding by the principles of object-oriented programming.
Notice that the constructor is called only after the class object is created by the scope rules or by the operator new. It is not called after a malloc() call. Similarly, the destructor is called only before the object is destroyed by the scope rules or by the operator ...
Read now
Unlock full access