Laboratory 8: Practice with C++ classes
In this lab, you will practice
some C++ classes concepts.
-
Topics to be explained by your TA.
-
constructors / destructors
-
private, public and protected class members
-
friend classes
-
allocating/deleting dynamic arrays
-
#ifndef #define ... #endif
-
using pointers to objects
SOLUTION
YOUR TASKS
Problem 1: Implement intstack.cpp
-
Create a C++ file that implements the methods declared in intstack.h.
-
Include this new file in your project.
-
Compile and run the program using Microsoft Visual Studio C++ .NET
Problem 2: Using pointers to objects
-
Declare a pointer to intstack and link it to your stack by doing:
-
intstack *pstack;
-
pstack= &mystack;
-
Use the pointer in order to manipulate your stack.