C++: Classes and objects

This entry is part 19 of 61 in the series C++

A class contains data and functions. A class could be understood as the object in an object-oriented program.

When we are defining a class, we are actually defining an object.

In object-oriented concept, or in any other object-oriented programming languages, we would usually call a function a method of the class.

As was mentioned, a class contains data members and methods.  The reason that we called them methods is mainly because it is through the methods that we act on the data in the class.

Data members could just be any integer or string which is similar to a variable in a procedural language.



Series Navigation<< C++: Function overloading
C++: A class with only data members >>

Leave a comment

Leave a Reply