my code:
#include "BaseProduct.h"
BaseProduct::BaseProduct(
const ProductBaseType baseType,
const int id,
const int quantity,
const Location location
) {
_baseType = baseType;
_id = id;
_quantity = quantity;
_location = location;
}
Error I'm getting:
no default constructor exists for class "Location"
I know there isn't any default constructor for Location, it's intended... I'm using VSCode if it's of any relevance.
Thanks in advance!
BaseProjectconstructor, instead of using the body. Also, if you're passing in objects, you should pass in by constant reference.constis an anti-pattern; you probably want to move them into the class members instead (otherwise you have a bunch of unnecessary copy operations)