After a lot of debugging I discovered a typing error, but am surprised the compiler let me away with naming a variable the same as a class name. Should that be allowed? This is a cut-down re-enactment of the crime. I used Phone as a pointer to a different class.
class PhoneData
{
public:
PhoneData(){};
~PhoneData(){};
int speed;
};
class Phone
{
public:
Phone(){};
~Phone(){};
int type;
};
int main()
{
Phone phone;
PhoneData *Phone = new PhoneData();
Phone->speed=1;
return 0;
}