#include <iostream>
usingnamespace std;
class B
{
public:
double Pos;
double Size;
double x;
};
B b1;
int main()
{
int Test = b1.Pos.x;
cout << Test << endl;
return 0;
}
i get error : request for member 'x' in 'b1.B::Pos', which is of non-class type 'double'
What are you trying to do here? Pos is a double, a decimal number, so b1.Pos.x does not make sense, as you are accessing the member Pos of b1 (b1.Pos), and then trying to access a member of Pos called x (b1.Pos.x). But Pos doesn't have members because it's a double, just a number. Additionally, you are not actually doing anything to Pos or x before printing them, so what is the purpose of this program? Finally, as is customary to point out, usingnamespace std; is really not a good habit to get into, so it would be better to simply put std::cout and std::endl, you're not even saving yourself keystrokes by having usingnamespace std; in this code.
EDIT: Probably should have refreshed the page before answering.