Practice problem classes and objects.

        Creating classes and objects in C++

Problem:

       Create a class named ClassRoom that has 6 private member variables named totalChairs, totalTables, classGrade, teacherName, totalStudents and classRep.
Your class must have public member functions named as input and output.
These two input and output functions will work as getter and setter.

You must also create a constructor that initializes the values of all the private member variables to null or 0.

Remember: We can use any name for our getter and setter function.

Now for our main method create an object of our class ClassRoom named Class1. Input values from the user by calling the Input function of the object Class1. Then output all the values.

All the above conditions must be fulfilled.

Visit here for reference about classes and objects:




Comments

Popular posts from this blog

Virtual function in c++

Multiple, Multilevel, Hybrid and Hierarchical inheritance