- Define a class Car which:
Stores the name, type, price, model year, number of color, and names of available colors
Includes a default constructor.
Includes a parameterized constructor.
Group of available colors is allocated dynamically in the parameterized constructor based on received number of color.
Includes a copy constructor.
Includes a destructor.
Includes set function for each data member.
Includes get function for each data member
o Get color function receives the index and return the corresponding color. - Define Print function as a global function that receives car object and prints its information (Hint use get function).
- Write a main program by creating necessary objects. Ask the user to fill in the data and print objects information.
____________________________________________________________________
i didn't understand this points "Get color function receives the index and return the corresponding color."
and " Ask the user to fill in the data and print objects information." can someone please explain it to me ? :(
Rawan_92line
0
Newbie Poster
Recommended Answers
Jump to PostI think it means that you create an array of color names. The GetColor() function has an argument of the color number (index number) and returns the name of the color. For example
char *colors[] = {"Red","Yellow","Green","Brown","white","black"}; char* GetColor(int index) {return colors[index];}
This is just a …
All 2 Replies
Reply to this topic
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.