Pregunta

I have a C++ class which, in short, has a declaration which looks like this:

class Pico {
  ...
  Document document; // Custom Document class
  ...
}

Later I call one of the public member functions of the Document class:

this->document->enableEditing();

However, IntelliSense underlines this and notes that "expression must have pointer type". What can I do to fix this?

¿Fue útil?

Solución

You want

this->document.enableEditing();

The Document member is not a pointer, therefore you need . in place of ->

Otros consejos

document is not a pointer, so you do not need the -> operator:

this->document.enableEditing();

In fact, in this case it isn't even necessary to use this explicitly. The following will do:

document.enableEditing();
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top