From C to C++ - classes
January 27, 2025, by Slobodan Dmitrovic
When moving from C to C++, classes are one of the biggest novelties we encounter. Classes are also one of the biggest differences between C and C++.
C++ for C developers - learning about classes
A class is a user-defined type consisting of data members and member functions. We also say a class is a complex type. The general syntax is:
class class_name
{
// class body
}
When learning about classes in C++, we should learn about the following topics:
- Data members
- Member functions
- An instance of a class - an object of a class
- Visibility specifiers
- Constructors
- Member initializer lists
- Destructors
More advanced topics involving classes
After learning about the basics of classes, we should learn about the following topics:
- Copy and move semantics
- Operator overloading
- Inheritance
- Virtual and overridden member functions
- Polymorphism
While structs are records in C, we can think of C++ classes as data plus functionality on that data wrapped into one type. An instance of a class is called an object. We use the object of a class to invoke member functions and manipulate data members.
Introduction to classes - training video
Here is our "Introduction to Classes" training video to get you started with the class definition, data members and member functions, and objects of a class. This video is part of our "Introduction to C++" video training course.

We also have a dedicated training course called "C++ for C Developers." For more info, contact us at contact@cppsrc.com.
Download the Brochure