Posts

Showing posts with the label classes

Practice problem classes and objects.

        Creating classes and objects in C++ Problem:        Create a class named ClassRoom  that has 6 private  member variables named t otalChairs, totalTables, classGrade, teacherName, totalStudents and  classRep. Your class must have 2  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: C++ classes and objects

Classes and objects in C++.

Object Oriented Programming: Four Principles: The four principles of object-oriented programming are encapsulation ,  abstraction ,  inheritance , and polymorphism . These words may sound scary for a junior developer. Object Oriented Programming is a concept that is based on real world objects. What is an object? An object is any independent unit. In object oriented programming you have to think more closer about the real world, as it is related to objects. An object can be a book,pen and person etc. A person is also an object. Every object has it's own unique identity ,just as objects in the real world do.    It is possible that two objects look identical, but they are still separate, unique objects. What are attributes? Object's also have characteristics that are used to describe them. For example: A car can be blue or black, a glass can be full or empty. Object's have multiple attributes . What are methods? Method describes the behavior of our object. Method is...