Posts for: #C++

Object-Oriented Programming in C++: Constructors

Introduction

After learning a bit about classes, objects, and access modifiers, we can move on to another important concept of Constructors and Destructors. This part will cover Constructors. We’ll explore what are constructors, why we need them, types of constructors, and their semantics in C++ as usual.

So without wasting any time, let’s get started.

What is a constructor

A constructor is a method just like another method in a class, but it has a special name for a reason. The name itself speaks, Constructor, which will get called just after the object gets created. A constructor is just a method but it should only have the name same as of the class, that’s the thing that distinguishes it from other methods.

[]

Object-Oriented Programming in C++: Access Modifiers

Introduction

Moving on to Part 2 of Object-Oriented Programming in C++, we will look into the concept of access modifiers which we skipped in the first section. This won’t be a comprehensive guide on access modifiers as it requires some other concepts like Inheritance which we will introduce in the next few sections. This series will be like connecting the pieces of OOP together and building a good foundation.

In this part, we will discuss the access modifiers and their related concepts. The below is a gist of what will be covered in this part.

[]

Object-Oriented Programming in C++: Classes and Objects

Introduction

We all know that C++ is famously known for Object-Oriented Programming, but what is Object-Oriented Programming? Well, this is the article, where we will explore the basics of Object-Oriented Programming, its building blocks i.e Classes and Objects, and get familiar with its basic semantics in C++. Let’s get into it straight away!

What is Object-Oriented Programming?

Object-Oriented Programming(OOP) is a way to structure and design a program or an application. Object-Oriented Programming deals with creating classes and objects and it’s related terminologies. OOP helps in following the principles like DRY(Don’t Repeat Yourself) and KISS(Keep it Simple Stupid). Using OOP certain applications and problems can be solved in a simple and efficient way. It helps in better understanding and readability of the code.

[]