mardi 27 février 2018

How do you create a container class that include a stack?

I am designing a container class called Process for a project in one of my classes. Process has a string that is the name of the process and stack ptr that points to a stack of a class called Function. Function is a class that has a string that is its name and a bool related to when it needs to be removed. My problem is that I can add items to the stack when I am using a stack on its own, however, I am having trouble doing so within Process. I can add an item to the stack but it disappears after the function ends even though it isn't included in that function. I think I have some sort of scope problem but I am not sure what it is. I created a smaller program that I have been trying to test the problem in. I attached all of those files here. If you make the program and run it as ./Test it will run.

Aucun commentaire:

Enregistrer un commentaire