0

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!

1
Contributor
1
Reply
2
Views
7 Years
Discussion Span
Last Post by Tom83B
0

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

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.