fructe.h:
enum Provider {
Orange, Melon, Plum
};
struct Fructe {
Provider provider = Orange;
void Info();
};
fructe.cpp:
#include "fructe.h"
#include <iostream>
using namespace std;
void Fructe::Info(){
switch(this->provider){
case Orange:
cout << "Orange\n";
break;
case Melon:
cout << "Melon\n";
break;
case Plum:
cout << "Plum\n";
break;
}
}
main.cpp:
#include "fructe.h"
int main(){
Fructe f;
f.Info();
f.provider = Plum;
f.Info();
f.provider = Melon;
f.Info();
return 0;
}