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)

🌚 Browsing with dark mode makes you a better developer.

It's a scientific fact.