Hello I started learning c++ and I'm following a video tutorial series.
For the sake of simplicity consider the following code:
#include <iostream>
using namespace std;
class Test{
public:
Test();
void printCrap();
private:
protected:
};
Test::Test(){
};
void Test::printCrap(){
cout << "I don't get this yet..." << endl;
};
int main(){
Test testOne;
Test *testTwo = &testOne;
testOne.printCrap();
testTwo->printCrap();
return 0;
};
It's similar to the tutorial's code with the only exception that I merged the code into 1 cpp for the sake of this question.
What the tutorial doesn't explain is beside the obvious what are is the actual difference / benefits and where is this applicable.Perhaps a scenario where -> vs . would matter?
testTwomay contain an invalid address (in the general case, not in your example)