You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Student(std::string name, int age) : name(name), age(age) {};
~Student() { std::cout << this << " Student Destructor is Called" << std::endl; }
};
/*
A shared pointer is a way to manage dynamically allocated memory in C++. It is a type of smart pointer that keeps track of the number of pointers pointing to a specific object. When the last pointer is deleted or goes out of scope, the object is automatically deleted.
*/
int main()
{
/*
We dont have to care about deleting shared_ptr since it auto delete the object when is went out
of the bond or we can say when our main function compeletely excicuted
*/
// Declaring a shared ptr of student class with parametere