This is a pointer, so try instead:
a->f();
Mostly an operator . (used to access the fields and methods of an object) is used for objects and references, therefore:
A a; af(); A& ref = a; ref.f();
If you have a pointer type, you must first dereference it to get a link:
A* ptr = new A(); (*ptr).f(); ptr->f();
a->b usually short for (*a).b .
Smart Pointers Note
operator-> can be overloaded, which is especially used by smart pointers. When you use smart pointers , you also use -> to reference the specified object:
auto ptr = make_unique<A>(); ptr->f();
Kos Jul 01 2018-11-11T00: 00Z
source share