Longtime java programmer here, getting my feet wet in C++ on a summer project. Most of the syntax and stuff is easy to overcome, but I've been struggling a bit with pointers and their syntax.
For example, in the following test code I made, the Driver class accepts two pointers in the constructor, which then are carried along by two other class-specific pointers. However, when I compile the code, I get the following message:
1> error C2227: left of '->resetSpeed' must point to class/struct/union/generic type
1> type is 'Auto **'
1>: error C2227: left of '->useTheTimer' must point to class/struct/union/generic type
1> type is 'TimeKeeper **'
1>: error C2227: left of '->runTheTimer' must point to class/struct/union/generic type
1> type is 'TimeKeeper **'
1>error C2227: left of '->checkCurrentSpeed' must point to class/struct/union/generic type
1> type is 'Auto **'
1>c: fatal error C1903: unable to recover from previous error(s); stopping compilation
I realize the main method below doesn't do much of anything, but I want to solve the above error before proceeding any further. I've copied the code below, but I've left out many of the other classes which compile fine.
I don't need to use pcar = &car, or the double pointers.
I just had to remove some of the middlemen pointers and it seemed to straighten itself out. All functions work as intended, and outputs look good so far.