Step-by-step explanation:
first of all, "and" is not a valid instruction in C++. I guess you put that in the description here.
so, it should be
void FancyCar::HonkHorn() {
if (car_model == "Honda Civic") {
cout << "The Honda Civic says beep beep!" << endl;
}
}
void FancyCar::HonkHorn() {
if (car_model == "Honda Civic") {
cout << "The Honda Civic says beep beep!" << endl;
}
else {
cout << "Beep beep!" << endl;
}
}
then, you should not define structures with exactly the same name and interface in parallel. in some systems this will be an error and in other systems it just means the compiler will take the last definition and forgets about the others.
but ultimately, I don't see the definition of the variable "car_model" and where it gets a value.
based on the flow of the code, it might have to be a (string) parameter for the function HonkHorn.
if you don't have any of that, in the best case the variable is created at its first appearance, gets a random value (most likely NOT "Honda Civic"), and the if-statement will never be true.