#include <iostream.h>#include <string.h>
struct charactor{
public:
float posX,posY;
};
class CLeft{
public:
charactor *C;
void SetP(charactor *Chara){C=Chara;}
float GetP(){return C->posX;}
};
class CRight{
public:
charactor Own;
CRight(CLeft cl,float px){Own.posX=px;cl.SetP(&Own);}
};
int main(){
CLeft cl;
CRight cr(cl,1.0f);
cout << cl.GetP() ;
return 0;
}
コンパイルは通るのですが、これを実行すると、エラーが出てしまいます。
構造体のポインタを宣言したところがまずいようなのですが、何が悪いのか
自分ではわかりません。アドバイスお願いします。