hi,
when i create an object of my class in main function. after program reached the closing scope of main will my object delete autonatically or should i free the space with delete operator?
For every new operator there should be a delete operator somewhere..If not memory leaks will occur. If main exits, all allocated memory from your program will be lost anyway but that doesn't mean that you should rely on this and leave ghost - objects hanging around.
Objects allocated on the stack ( Type myVariablke; )will be destroyed when the end of the scope of their declaration is reached
Objects allocated on the heap (Type* myVariable= new Type(); ) will be destroyed when you call delete on their pointer