Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Basic question about deleting custom objs

Status
Not open for further replies.

mcowen

Programmer
Joined
Oct 21, 2001
Messages
134
Location
GB
Hi all,

I have a bad bit of memory block here (I think its due to doing too much Java). I have a container class called jobslot having another custom obj called job. I want to be able to delete the job from the slot therefore I have a RemoveJob() function within jobslot. I cant remember how to delete the job object (its derived from CObject). "null" doesnt seem to do it and I cant find any member functions that do the job either.

Regards
Matt
 
I have just tried this...

RemoveJob()
{ currentjob.~Job();
}

This compiles but I cant test it at the mo. Does anyone know for sure whether this is the answer?
 
Yep... Java don't use pointers at all...

Declare your job class as a pointer:
Job* job;

Initialize it with
job = new Job(constructor args)

in remove job use:

delete job;
[red]Nosferatu[/red]
We are what we eat...
There's no such thing as free meal...
once stated: methane@personal.ro
 
Status
Not open for further replies.

Similar threads

Replies
0
Views
289
  • Locked
  • Question Question
Replies
2
Views
396
Replies
1
Views
233

Part and Inventory Search

Sponsor

Back
Top