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?
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) { }
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.