Hello guys i just thinking why my code doesnt work
so i have a class Dispenser with attribute ingredient : Ingredient* and number : int;
in my Class Ingredient i have a attribute name : string
so i want to make relation between dispenser and ingredient
int main(){
vector<Dispenser*> dispensers;
Dispenser* d1 = new Dispenser;
Dispenser* d2 = new Dispenser;
Dispenser* d3 = new Dispenser;
Dispenser* d4 = new Dispenser;
Dispenser* d5 = new Dispenser;
Dispenser* d6 = new Dispenser;
Dispenser* d7 = new Dispenser;
Dispenser* d8 = new Dispenser;
Dispenser* d9 = new Dispenser;
> so i want to make relation between dispenser and ingredient
>> so i have a class Dispenser with attribute ingredient
there is your relationship. A dispenser has an ingredient.
> when i start the program it suddenly exit.
Blind guess: segmentation fault because you were trying to dereference an invalid pointer.
¿why do you have dynamic allocation? http://www.cplusplus.com/forum/general/138037/