Hello!
I want to use static_cast<int> on a void* member Variable in another class. (class aMessage). aMessage class has a public variable void* pVar. While using static_cast on a local variable is running smoothly, I get a compiler error trying to cast it on the aMessage->pVar.
pVar is being declared in gMessage.
pVar is also being initialized in constructor with
gMessage::gMessage(unsigned short int passedType, std::string passedString):pVar(0){...}
This is the flawed code:
void gFont::AddTest(int passedPosition, std::string passedString, void *passedVar, void *passedVar2)
{
gMessage* aMessage = new gMessage(1, passedString); // Constructor for gMessage, initializing
int* passedInt=static_cast<int*> (passedVar); // This one works without problem!
aMessage->pVar=passedInt;
int* aMessage->pVar=static_cast<int*> (aMessage->pVar); // This one does not work at all (see log beneath)
}
D:\C++ Projects\Project1\project.cpp||In member function `void gFont::AddTest(int, std::string, void*, void*)':|
D:\C++ Projects\Project1\project.cpp|1918|error: expected initializer before '->' token|
Any help is very appreciated. Thank you!