Tuesday, November 13, 2007

Little Sugar : Casting away constant ness

In C++ if you create a constant object , say

const String A("Hello World");

String& B = const_cast(A);

can be used to create a non constant reference to the so called constant object and hence
manipulate it .

Monday, November 12, 2007

Little Sugar :const function pointers and references

The syntax in c++ for constant function pointers is like this

Handle& (*const getHandle) = handle;

where handle is a function returning a reference to the handle.

The syntax for reference function pointers is like this:

Handle& (&getHandle) = handle;