In c++ Create a class named Restaurant that has two member objects: a Burger object, and a Fries object. In addition to this, it also has a member variable named name, to allow you to name your Restaurant. Burger has two member variables: double weight; int number_of_toppings; Fries has two member variables: string potato_type; char size; Write the code for all three classes. You will need to determine what functions are necessary to initialize all the members of the Restaurant class and write those necessary functions. Finally, you will write the code in the main that you would use to declare a Restaurant object, and set the different member variables.
OOPs
In today's technology-driven world, computer programming skills are in high demand. The object-oriented programming (OOP) approach is very much useful while designing and maintaining software programs. Object-oriented programming (OOP) is a basic programming paradigm that almost every developer has used at some stage in their career.
Constructor
The easiest way to think of a constructor in object-oriented programming (OOP) languages is:
In c++
Create a class named Restaurant that has two member objects: a Burger object, and a Fries object. In addition to this, it also has a member variable named name, to allow you to name your Restaurant.
Burger has two member variables:
double weight;
int number_of_toppings;
Fries has two member variables:
string potato_type;
char size;
Write the code for all three classes. You will need to determine what functions are necessary to initialize all the members of the Restaurant class and write those necessary functions.
Finally, you will write the code in the main that you would use to declare a Restaurant object, and set the different member variables.
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 4 images