Complete Todo Code Refer Https Wwwcheggcom Homework Help Questions Answers Complete Todo C Q37210490

Complete TODO in code below:

refer to:

https://www.chegg.com/homework-help/questions-and-answers/complete-todo-c-codes-thank-advance-pragma-include-iarrayh-abstract-class-extend-base-aarr-q37200472?trackid=r5cfOOy4

https://www.chegg.com/homework-help/questions-and-answers/complete-todo-code-refer-https-wwwcheggcom-homework-help-questions-answers-complete-todo-c-q37210412?trackid=lWZVm0Qs

#pragma once

#include “AArray.h”

// This is a simple managed array class that willallocate

// new space to grow/shrink its buffer “under thehood”

template<typename T>

class SArray

: public AArray<T>

{

private:

unsigned capacity;

// Use a private helper method to resize the currentbuffer?

void reallocate(unsignedcap)

{

// Write a helper method to determine new size?

// cap = nextsize(cap);

// TODO: Reallocate the current buffer to be

// at least twice as large

}

public:

SArray()

: capacity(0)

{

}

SArray(const AArray<T>& other)

: AArray<T>(other), capacity(0)

{

}

virtual ~SArray()

{

}

virtual voidinsert(const T& elem,unsigned pos)

{

if (pos >this->size())

throw IArray<T>::ARRAY_OVERFLOW;

// TODO: write an insert method

}

virtual voidinsert(const IArray<T>& other,unsigned pos)

{

if (pos >this->size())

throw IArray<T>::ARRAY_OVERFLOW;

// TODO: write an insert method

}

virtual voidremove(unsigned pos, unsigned num= 1)

{

// TODO: write

OR
OR

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.