Possible Duplicate:
C++: What is the size of an object of an empty class?
if the class does not have any data member and just has the mehod, it still has a chance of memory leak. First the class method is reference to class object and object still needs memory to store the address when allocating. Am I correct?
class Empty
{
doA()
{
}
};
Yes, you can still leak memory on that type. You can leak on any type, even a type with no members.
sizeof(EmptyClass)will never equal 0. See: http://www.stroustrup.com/#sizeof-emptyFrom the spec: