Write the syntax for creating the class and object for the following
1)class name fruit object mango
2)class name school object student
3)class name vehicle object bus
4)class name flower object rose
5)class name animal object dog
PLEASE I REQUEST U TO GIVE CORRECT ANSWER
Answers
Answered by
1
Answer:
SYNTAX AS FOLLOWS
class fruit
{
private: //declare variables
public: /*member functions
example void taste() {statements} */
} ;
int main()
{
//class _name object
fruit mango;
mango.taste();
}
Explanation:
replace the class name and object name for 2 to 5 and the syntax follows same for all
Instead of mamber function void tasts()
Use other functions like
2)student_markslist() ;
3)bus_features();
4)flower_colour() ;
5)pet_details();//like colour weight name etc ;
HOPE IT HELPS YOU
DO FOLLOW FOR MORE ANSWERS/PROGRAMS
MARK AS BRAINLIEST
Similar questions