main.cpp :
#include <iostream>
#include "bitentete.h"
using namespace std;
int main() {
int age;
cin >> age;
/* cout<<"Testou";
if (peutPasserIf(age) == true) {
cout << "Entre mon gars, amuse toi bien.";
}
else {
cout << "Degage mon gate";
}*/
baSwitch(age);
return 0;
}
bit.cpp :
#include <string>
#include <iostream>
#include "bitentete.h"
using namespace std;
int agePlusOneYear(int age){
return age+1;
}
int ageMinusOneYear(int age) {
return age - 1;
}
bool peutPasserIf(int age) {
return (age >= 18);
}
string baSwitch(int age) {
switch (age) {
case 18:
cout << "Tu rentres piles poil mon ane !";
case 666:
cout << "Entre mon cretin.";
case 20:
cout << "Alors la vingtaine mon gars ca va ?";
case 16:
cout << "Désolé, ouvert qu'au papy.";
}
return "Tiens une bouteille de vingt";
}
bitentete.h :
#ifndef BIT_H_INCLUDED
#define BIT_H_INCLUDED
int agePlusOneYear(int age);
int ageMinusOneYear(int age);
//bool peutPasserIf(int age);
string baSwitch(int age);
#endif // BIT_H_INCLUDED
Issue: E0311
cannot override functions distinguished by return type only (with google translate because i'm french and the error was in my language)
The name of baSwitch is underlined in red in bit.cpp and .h