C++ Constructor with variable initialization

C++ Constructor with variable initialization

I am reading a book about data structures and I stumbled upon this block of code:

I am reading a book about data structures and I stumbled upon this block of code:

class UnorderedArray 
{
public:
UnorderedArray(int size, int growBy = 1) :
    m_array(NULL), m_maxSize(0), m_growSize(0), m_numElements(0)
{
    if (size) {
        m_maxSize = size;
        m_array = new T[m_maxSize];

    m_growSize = ((growBy > 0) ? growBy : 0);
}

}

private: T * m_array;

int m_maxSize; int m_growSize; int m_numElements;

}

Can someone explain this block of code for me?

UnorderedArray(int size, int growBy = 1) :
m_array(NULL), m_maxSize(0), m_growSize(0), m_numElements(0)

I believe this is some sort of initialization for those variables but I can't seem to find a concrete answer.

Angular 9 Tutorial: Learn to Build a CRUD Angular App Quickly

What's new in Bootstrap 5 and when Bootstrap 5 release date?

Brave, Chrome, Firefox, Opera or Edge: Which is Better and Faster?

How to Build Progressive Web Apps (PWA) using Angular 9

What is new features in Javascript ES2020 ECMAScript 2020

C/C++ vs. Rust: A developer’s perspective

In this post, you'll see the difference between Rust and C/C++ in a developer’s perspective

Variable Introduction in C#[Bangla]

LIKE | COMMENT | SHARE | SUBSCRIBE A variable is nothing but a name given to a storage area that our programs can manipulate. Each variable in C# has a speci...