Hello C++ Developers,
LearnCPlusPlus.org is a magical crate full of things you can easily use to learn how to program with the C++ programming language. I believe this and everything I do is aimed at giving you a rapid introduction to programming in C++ and using C++ Software for a beginner, all the way to the most robust, modern, and latest techniques for those more experienced with the language or are perhaps wanting to expand their knowledge with the most up-to-date features, routines, and methodologies.
Table of Contents
C++ classes, constructors and explicit specifiers
This week we have few more posts about Default Constructors. We will keep diving into Classes & Objects in the next weeks we started to release posts about Copy Constructors. We have a post about Explicit Specifiers (no Parental Advisory required) with examples. For game developers, we have a topic about developing a simple text-based adventure game. For the more advanced, we have two CppCon videos that we pick about Concurrency and Exceptions.
As we mentioned before in many posts about classes in C++, one of the most powerful features of C++ is Object-Oriented Programming (OOP), which makes it different from the C programming language by using Classes, Objects, and more. Object-Oriented Programming has many advantages over procedural programming, and it is the most characteristic feature of the C++ programming language.
Let’s remind ourselves about C++ constructors
The Constructor in C++ is a function, a method in the class, but it is a ‘special method’ that is automatically called when an object of a class is created. We don’t need to call this function. Whenever a new object of a class is created, the Constructor allows the class to initialize member variables or allocate storage. This is why the name Constructor is given to this special method.
If we dive into Constructors subject, there are different contractor types
- Default Constructor (Last week and this week’s peeks are about these)
- Copy Constructor
- Move Constructor (since C++11)
- Copy Assignment operator
- Move Assignment operator (since C++11)
Most of these methods is not only used in classes but also used with struct and union data types, and the Default Constructor in classes is one of these.
What is default constructor in C++?
A Default Constructor in C++ is a constructor type in Classes that is called when class is defined with no arguments. It can also be defined with an empty parameter list, or with default arguments provided for every parameter. A type with a public default constructor is Default Constructible;
This week we answer the following questions on the LearnCPlusPlus.org website:
- What is Implicitly Declared Default Constructor?
- What means Eligible Default Constructor in C++?
- Can I have an example about Explicit Specifier in C++ Classes? What is Explicit Specifier?
- How can I develop a text based adventure game in C++ ?
- Where can I find a professional video about Exceptions in C++?
- How can I learn Concurrency in C++ with a professional video?
Our Learn C++ post picks of this week
- Learn Implicitly Defined Default Constructor in C++
- Learn about Eligible Default Constructor in C++
- Learn About Explicit Specifier in C++ Classes
- Learn to Develop a Text Based Simple Adventure Game in C++ on Windows
- Learn C++ With Back to Basics: Concurrency by Arthur O’Dwyer (CPPCon 2020) Video
- Learn C++ With Exceptions Under the Spotlight by Inbal Levi (CPPCon 2020) Video
We will continue to OOP with Constructors and Visualization, AI Technologies in C++ the next weeks. Please keep following our LearnCPlusPlus.org website for the latest posts and updates. Feel free to comment and share with your colleagues, students, members – knowledge is power, and knowledge shared is empowering.
C++ Builder is the easiest and fastest C and C++ IDE for building simple or professional applications on the Windows, MacOS, iOS & Android operating systems. There is a free C++ Builder Community Edition for students, beginners, and startups; it can be downloaded from here. For professional developers, we have Professional, Architect, or Enterprise versions of C++ Builder and there is a trial version you can download from here.