So if I understand what you said, you have two classes, your
DriveTrain
class and another which you didn't include, let's say
Motor
class.
So you want to pass as an argument, an object of the motor class to the constructor of the drivetrain class.
Assuming, line 3,
int motor1, motor2, motor3, motor4, dir, vel;
that the motors there are those you wish to assign to objects from your motor class. In which case they shouldn't be ints, but
Motor
. Also if you haven't done it you should include your Motor class header file to your drivetrain file.
I don't know what your debugger is telling you, but what is
dt((motor1, motor2, motor3, motor4);
dt? it doesn't have a type in front of it. Is it a void function? Also you have one too many parenthesis.
Also I'm not sure this syntax is allowed :
DriveTrain dt(FLMotor, FRMotor, BLMotor,BRMotor);
since it's your constructor, I assume what you want to do is that:
1 2 3 4
|
DriveTrain (Motor FLMotor,Motor FRMotor,Motor BLMotor,Motor BRMotor)
{
dt (FLMotor, FRMotor, BLMotor, BRMotor);
}
| |
To use dt that way :
dt.drive(fwd, 20);
it has to be an object, but it looks like you defined it as a function above.