I was wondering what the standard procedure is for callingfunctions inside class
ID: 3608571 • Letter: I
Question
I was wondering what the standard procedure is for callingfunctions inside classes.include <iostream>
using namespace std;
#include "DoubleList.h"
DoubleList::DoubleList()
{
//This is how many elements aray can store
size = 10;
//This is the current size ie) num elements
position = 0;
array = new double[size];
}
//////////////////////////////////////////////////
// Adds a new double aDouble to end of array
//////////////////////////////////////////////////
void DoubleList::addDouble(double aDouble)
{
if(size == position)
{
createArray();
}
}
void DoubleList::creatArray()
{
size += 10;
double* temp = new double[size];
for(int count=0; count < position; count++)
{
// temp[count] =array[count];
}
// delete [] array;
//*array = temp;
}
//***************************************************************
//******* H file************************************************
/*DoubleList.h*/
#include <iostream>
using namespace std;
class DoubleList
{
public:
//A constructor for a new double arrary.
//The size is initialized to 10 but is dynamic
DoubleList ();
//Adds "aDouble" to the end of an array
void addDouble(double aDouble);
//remove double from end of list
void removeDouble();
//get double at index
void getDouble(int index);
//gets number of doubles in array
int getNumDoubles();
private:
int size;
double* array;
int position;
void creatArray();
};
Explanation / Answer
please rate - thanks This site should help explain to you that it is called the same asif it wasn't in a class http://www.eggheadcafe.com/software/aspnet/31844556/call-base-class-function.aspx
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.