When I declare a pointer to card (to test) in main
card *testtype
the below code compiles with no error.
but when I declare in main
card testtype
i get a compile time error.
I hope the mistake I am making is obvious.
I am going back to OOD programming off the cuff, and not following tutorials,
as I want to understand how to code in OOD better. Can someone break down the mistake I am making. E.g why it works with pointer, vs not.
Because you never called delete on the pointer, thus the compiler never looks for or cares about the destructor. If you never called new either, the compiler could care less about the constructor too.