Sunday, March 02, 2008

Little Sugar : C++

The only to initialize const pointers in c++ within a class , is via member initialization list.

class MyClass{

Data * const data_ptr;

MyClass(Data * const value) : data_ptr(value)
{}
};

No comments: