What is the error of the following program?
Solutions:
take note that the dot operator or "." cannot be used for
the "this" pointer
warning: In instantiation of 'void LinkedList<T>::setVariableName(std::__cxx11::string)
[with T = int; std::__cxx11::string = std::__cxx11::basic_string<char>]':
warning continued: required from here
error: request for member 'variableName' in '(LinkedList<int>*)this',
which is of pointer type 'LinkedList<int>*' (maybe you meant to use '->' ?)
error: request for member 'variableName' in '(LinkedList<int>*)this',
which is of pointer type 'LinkedList<int>*' (maybe you meant to use '->' ?)
Solution:
dot operator error at the "this" pointer
you cannot use the dot operator or "." for the "this" pointer,
change to the right arrow operator or ->
No comments:
Post a Comment