DEV Community

Quoc Bao
Quoc Bao

Posted on

 

Introduction to OOP and array class implementation [part 2]

Last time, we left off with the default constructor. Remember that it has no arguments, which is why it is also called non-parameterized constructor. Therefore, this time we’ll kick off with parameterized constructor, which takes in user’s initial values.

Array::Array(int num_elements)
{
    allocate(this->A, num_elements);
    this->na = 0;
    this->capacity_a = num_elements;
}
Enter fullscreen mode Exit fullscreen mode

Read more here!

Top comments (0)

Timeless DEV post...

Git Concepts I Wish I Knew Years Ago

The most used technology by developers is not Javascript.

It's not Python or HTML.

It hardly even gets mentioned in interviews or listed as a pre-requisite for jobs.

I'm talking about Git and version control of course.

One does not simply learn git