#include using namespace std; struct SimpleT{ int one; string two; }; class SecondT{ public: SecondT() { number = 3; word = "hello"; } int Number(void) const { return number;} string Word(void) const { return word;} void Number(int n) { number = n; return;} void Word(string w) { word = w; return ;} private: int number; string word; }; int main() { int a =7; cout << "A pointer to a is " << & a << endl; // out of order don't do this but for discussion. int * pointerToA = 0; int * secondPtrToA = NULL; int * thirdPtrToA = nullptr; pointerToA = & a; secondPtrToA = pointerToA; thirdPtrToA = pointerToA; cout << " pointerToA = " << pointerToA << endl; cout << " secondPtrToA = " << secondPtrToA << endl; cout << " thirdPtrToA = " << thirdPtrToA << endl; cout << endl << endl; cout << "*pointerToA = " << *pointerToA << endl; cout << "a = " << a << endl; *pointerToA = 99; cout << endl; cout << " after *pointerToA = 99; " << endl; cout << "*pointerToA = " << *pointerToA << endl; cout << "a = " << a << endl; cout << endl << endl; // out of order don't do this but for discussion. SimpleT s1; SimpleT *s1Ptr = nullptr; s1.one = 9; s1.two = "Hello World"; s1Ptr = & s1; cout << "The name is " << s1Ptr->two << endl; cout << "The number is " << s1Ptr->one << endl; s1Ptr->one = 99; s1Ptr->two = "This is changed "; cout << "Indirect: The name is " << s1Ptr->two << endl; cout << "Direct: The name is " << s1.two << endl; cout << "Indirect: The number is " << s1Ptr->one << endl; cout << "Direct: The number is " << s1.one << endl; cout << endl; SecondT c1, * c1Ptr; c1Ptr = &c1; cout << c1Ptr->Word() << endl; c1Ptr ->Word("changed value " ); cout << c1Ptr->Word() << endl; return 0; }