In a class use the new operator to crate a object of the class . Their constructor is used to allocat memory for the data member and fucntion , and distructor is use to free the memory . If we use delete inplace of distructor , will it work ???
141550
0
Newbie Poster
Recommended Answers
Jump to Postdestructor is called for once the program ends and memory is de-allocated for a class.i guess there also exists a default destructor(though i'm not sure). However using delete explicitly causes no harm.
All 4 Replies
adarshcu
9
Junior Poster
141550
0
Newbie Poster
Ancient Dragon
5,243
Achieved Level 70
Team Colleague
Featured Poster
kvprajapati
1,826
Posting Genius
Team Colleague
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.