Answer:
Following are the statements for the above question in c++ language:-
class City //Class definition.
{
string cityName; //String data type for cityName variable.
Location position; //Structure Location data type for position variable.
};
City destination; //class city variable destination.
Step-by-step explanation:
- The above question asked to declare a class whose name is the city which contains the two variable cityname of type string and position of type Location structure which is defined above. So the above-defined are the statement which does all task.
- But before the use of it, any user needs to define the location structure otherwise the statement "Location position;" gives the compile-time error.
- The syntax to define a class and the instances is defined below :-
Class class_name
{
//datatype variable
}
class_name instances_name;