G
Gurikar
Hello,
Can anyone tell me whats wrong in this?
// template function
template<class T>
inline void test(T* ptr)
{
cout<<"Pointer is"<<ptr<<endl;
ptr = NULL;
cout<<"Pointer is"<<ptr<<endl;
}
// Some class
Class A()
{
A();
}
// main function
int main()
{
A* pObj = new A();
test(pObj );
if (pObj == NULL)
{
cout<<"Mem fail"<<endl;
}
My question, even after making the pointer pObj = NULL in template
function test, when it comes to main the value of pObj wont be NULL,
Why is this???
Regards
}
Can anyone tell me whats wrong in this?
// template function
template<class T>
inline void test(T* ptr)
{
cout<<"Pointer is"<<ptr<<endl;
ptr = NULL;
cout<<"Pointer is"<<ptr<<endl;
}
// Some class
Class A()
{
A();
}
// main function
int main()
{
A* pObj = new A();
test(pObj );
if (pObj == NULL)
{
cout<<"Mem fail"<<endl;
}
My question, even after making the pointer pObj = NULL in template
function test, when it comes to main the value of pObj wont be NULL,
Why is this???
Regards
}