Showing posts with label oop. Show all posts
Showing posts with label oop. Show all posts

Sunday, 16 March 2014

What are smart pointers?

Pointers are extremely useful, but they are also the source of hard-to-detect memory leaks. "Smart" pointers attempt to address this problem.

Sunday, 22 December 2013

Using multiple inheritance to decrease compile time

When working on a modest-scale project, long compile times can be both a blessing (coffee breaks, anyone?) or an annoyance (staring at the screen with a long face). Most of the time, long compile times are an indication of poor design. Here's a tip on using multiple inheritance to decrease the compile time and improve maintainability.

Sunday, 24 November 2013

Circular references and forward declarations

In OOP, circular references occur when a class A needs to refer to another class B which also needs to refer to the referring class A.

Sunday, 29 September 2013

The static member in a nested class

Sometimes, it is desired to track the number of objects created on the heap by a particular class. Suppose class A_outer has a nested class A_inner. A_outer creates objects of A_inner on the heap. Is it possible to track how many A_inner objects were created by an instance of A_outer using a static member in A_inner?