Thread: c++ query
View Single Post
Old 26-07-2007, 10:35 PM   #8 (permalink)
abhi_10_20
Cool and Calm
 
abhi_10_20's Avatar
 
Join Date: Jul 2006
Location: Bangalore
Posts: 406
Default Re: c++ query

Quote:
Originally Posted by shirish_nagar
So, even after you called Destructor, object is still there.
r we calling the destructor?
i doubt...i think the destructor is calld automatically...see this...

class abc
{
data....
print()
~abc()
{
printf("Hello\n");
}
};

main()
{
abc a1;
a1.print();
}

the output wud contain "Hello" on last line......
this means when the object has been used and it is the end of the program, the destructor function is implicitly called to free up memory space allocated to object.....

wud this not mean that a destructor is called to destroy the object?
__________________
When Roger's at play, opponents pray..!!!!! :twisted:
abhi_10_20 is offline