#include using namespace std; class SillyT { public: SillyT() { cout << "\tIn the constructor." << endl; } ~SillyT() { cout << "\tIn the destructor." << endl; } void Poke() const { cout << "\tYou poked me! " << endl; } }; int main() { // step 1, just a single varaiable cout << "First Line of code " << endl; SillyT * s{nullptr}; cout << endl; cout << "Before the new " << endl; s = new SillyT; cout << endl; s->Poke(); cout << endl; cout << "Before the delete " << endl; delete s; s->Poke(); s = nullptr; cout << endl; // step 2, an array or two cout << "Before s = new SillyT[5] " << endl; s = new SillyT[5]; cout << endl; cout << "Poking in a for loop " << endl; for(int i = 0; i < 5; ++i) { s[i].Poke(); } cout << endl; cout << "delete[] " << endl; delete[] s; s = nullptr; cout << endl; return 0; }