Hello everyone, ive been working on this program for a bit trying to figure out how to properly use classes with paramaters, but with the code that i have below i seem to be getting an error telling me that the line with the prototype with paramaters (line 23) does not match with anything in my class 'Product'.
How can i fix this?
In your class definition, you only declared a prototype for default constructor(constructor without parameters)
In line 23, you are trying to give a definition for a constructor with parameters but you did not declare such function in your class
To fix, your class definition should have a prototype of a constructor with parameters like:
1 2 3 4 5 6 7 8 9 10 11 12
class Product {
public:
Product(); // default constructor
Product(string newName, double newPrice, int newQuantity) // cons with parametersvoid read();
void print() const;
private:
string name;
double price;
int quantity;
};