These operators are used to access data member/ functions of a class data types (also struct and union).
If you define an object of the mentioned types you can use the "." to access each members. But if you define a pointer of these types, you need to use "->" to access their members.
example:
#include<iostream>
using namespace std;
class Sample {
public:
int var;
Sample() {
var = 5;
}
};
int main() {
Sample a = Sample();
Sample* a_ptr = &a;
cout << "Since a in an object use dot operator " << a.var << "\n";
cout << " Since a in an object use arrow operator " << a_ptr->var << "\n";
return 0;
}