C++: object-oriented programming

Example:

class Animal {
   public:
      void sound() {
         cout << "Animal makes a sound" << endl;
      }
};
C++ supports the features of object-oriented programming.

Solution:

Animal obj;
obj.sound();  // Outputs: Animal makes a sound

Beginner's Guide to C++