"newsock" <ne*****@hotmail.com> wrote in
news:CN*********************@bgtnsc05-news.ops.worldnet.att.net:
1. What to do to force an auto_ptr release the object it pointing at
before reaching the end of the scope it resides?
Is this a homework assignment? Look up auto_ptr in your documentation.
One of the member functions has a name that makes it obvious which one
does what you want.
2. If a class is defined as:
class Student
{
int nAge;
int nID;
char sAddress[100];
};
This has only private members.
And two Student objects are created: student1 and student2.
You can't do that because the constructor is private.
Using auto_ptr, what should do to make "student1" and "student2" point
to the same address?
You said student1 and student2 were Student objects, not Student pointers
pointers, so they can't point to anything. It is not clear how you are
using auto_ptr here anyway.
Gregg