0

point2d is a struct containing two double vars x and y.

Projectile::Projectile(Point2D p1, double x1, double y1){
    : xVel(x1), yVel(x1), pos.x(p1.x), pos.y(p1.y) { } 
}

Gives an error message saying expected expression at the : Any ideas, not a matter of data type because all are double?

1 Answers1

5

You have an extra set of braces that you need to remove:

Projectile::Projectile(Point2D p1, double x1, double y1){ // <-- here
    : xVel(x1), yVel(x1), pos.x(p1.x), pos.y(p1.y) { } 
} // <-- here

Should be this instead:

Projectile::Projectile(Point2D p1, double x1, double y1)
    : xVel(x1), yVel(x1), pos.x(p1.x), pos.y(p1.y) { } 
Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770