Hi all!

This is from my code:

struct R3
{
       float x;
       float y;
       float z;
       
       R3(float, float, float);
       R3();
};

R3::R3(float a, float b, float c)
{
        x = a;
        y = b;
        z = c;
}

R3::R3()
{
        x = 0;
        y = 0;
        z = 0;
}

struct Bodies
{
       int Mass;
       float Dist[100];
       R3 Place(float, float, float);
       R3 Speed(float, float, float);
       R3 Acc(float, float, float);
     
       Bodies(int, R3, R3, R3);
};

Bodies::Bodies(int M, R3 XYZ, R3 V, R3 A)
{
       Mass = M;
       Place.x = XYZ.x;
       Place.y = XYZ.y;
       Place.z = XYZ.z;
       Speed.x = V.x;
       Speed.y = V.y;
       Speed.z = V.z;
       Acc.x = A.x;
       Acc.y = A.y;
       Acc.z = A.z;
}

The assigments in

Bodies::Bodies(int M, R3 XYZ, R3 V, R3 A)

somehow don't work. Dev-C++ is showing the error "insufficient contextual information to determine type" and when I write just

Place = XYZ

it's showing "invalid use of member (did you forget the '&'?)". According to my tutorial (from cplusplus.com), both ways should be all right... :-/

Could you please tell me where might be the problem?

Thanks for all your answers!

Already solved the problem. Place, Speed and Acc were declared as functions.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.