devxlogo

Tip Bank

New and Delete

Question: In my class declaration I have a member: CSomeUsefulClass* m_one; In my implementation file, there is a function: DoMyThing(){CSomeUsefulClass* m_two;m_two = new CSomeUsefulClass(param1, param2);//blah…m_one = m_two;//do my thing…} then

Rethrowing a Throwable Exception in Your Code

Use the fillInStackTrace() method to rethrow a Throwable type of exceptional condition in your code. This is useful if you want to rethrow a exception that occurred while using a

Using dynamic_cast Properly

Programmers who use dynamic_cast sometime discover that their applications suffer from mysterious crashes although seemingly, they are bug free. In most cases, the reason is that they forgot to turn

Escape Sequences

Certain special characters are represented as escape sequences. An escape sequence begins with a (backslash) followed by an alphanumeric character. For example, the escape sequence represents the newline character. Note

Taking an Address of a Pointer

The sequence && is parsed as the logical AND operator. According to the Maximal Munch parsing principle, it’s never construed as two & (address of) operators: void func (char **

Invoking a Function Through a Pointer

When you call a function through a pointer to function, use that pointer as if it were the function itself, not a pointer. For example: #include char buff[10];void (*pf) (char