I need some clarification about this issue. I have a class called con.
class con
{
public:
con();
int readIndex;
}
in con.cpp:
con::con()
{
readIndex = 0;
}
in main:
con = new con();
now readIndex is not 0 as I wanted. Watch window shows that the value is 0xcdcdcdcd {???}
and the type is now int*
and not int
which means that a variable will become a pointer if it's class object is created using new
? I then tried to change the code to *readIndex = 0;
but I got a write access violation. So how should I set the value of readIndex to 0 after all?
`