Jan 292013
 

Can we use delete operator on this inside a class member function in C++, something like below:

    class TestClass
    {
        public:
            void myFunc()
            {
                delete this;
            }
    };

Continue reading »

Oct 192012
 

Comma in C and C++ comes in two flavours

  1. As separator (used to separate parameters in a function call)
  2. As operator (rarely used)

The two flavors are as different as it can be. Lets discuss them one by one:
Continue reading »

Jun 132012
 

Yesterday I talked about what are user-defined conversions and how Single Argument constructor and overloaded type conversions operators act as type conversions from a Class (user-defined type) to any other type and vica-versa.

Today’s questions is more like a design question, C++ provide us the functionality to define user-defined type conversions, but should is it a good design to define such type conversions in our class? Continue reading »