I really need a good understanding with -> .
I went through numerous times through textbooks, but I just do not understand how to use it! Would someone please explain easily with examples? Thank you!
#include <iostream>
class vertex_data {
public:
float x;
float y;
};
int main() {
vertex_data * a; //create a pointer to an instance of the class vertex_data.
vertex_data b;
a = &b;
a->x = 10 // member x of object pointed by a is initialised with the value 10.
(*a).x = 10; // exact same instruction, just not as great syntactic sugar and can get a little confusing.
return 0;
}