I have a free function as part of a class. In the constructor for the class i am doing some malloc operations . So in the destructor i am trying to free that memory. But VS10 compiler complains that the
free(pointer);
doesn’t match the signature of the free function of my class.
So question is In a class wherein if we have implemented methods which have same names as that of standard library functions . How to call one over the other.
Regards,
You should qualify your call to the function:
This will pick up the
freefunction in the global namespace and not in your class.#include <cstdio>also putsfreeandmallocinto thestdnamespace, sostd::freeandstd::mallocwill also work.(Use of
new/deleteshould also be considered, as well as smart pointers.)