pointer and Class help

These are the class specifications

Class Name: IntVector
Public Attributes: NONE
Private Attributes: Pointer to the storage
Current size of storage

Public Methods:

IntVector() Constructor
Creates an empty instance with no space allocated.
The size attribute value is set to zero.

~IntVector() Destructor
Releases spaces that was allocated by the instance.

int getSize() Accessor to size attribute
This method returns the current size of storage.
int itemAt(int i) Method to return a value in a cell specified by i.
This method returns a value stored in a cell indexed by i. If
i is less than 0, or i is greater than current size – 1, or the
instance is empty, this method returns 0. Otherwise this
method returns the value stored at the location.

int itemAt(int i, int nVal)
Method to assign a value to a cell specified by i.

This method assigns a value specified by nVal to a cell of
The vector specified by i. The value nVal is returned by
method. If the index specified by i is less than 0, the
method returns 0, and does not proceed. If the index
specified by i, is greater than current size – 1, the storage is
resized to accommodate the index in the increments of 5.
After the store has been resized, any unused cells should
be set to zero.

void display() Method to display the contents of the vector.

This method displays the contents of the vector. If the
vector stores the values 3, 4, 1, 0, 2, 10, 0, 0, 0 in the cells
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, respectively, it should be
displayed on the screen as:
{3, 4, 1, 0, 2, 10, 0, 0, 0}.



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
  #ifndef INTVECTOR_H_DEFINED
#define INTVECTOR_H_DEFINED


class IntVector
{
    private:
        int* ptrTemp;
        int* ptrStore;

    public:
        /** Default constructor */
        IntVector();

        //destructor
        ~InvVector();

        //accessor to size
        int getSize();

        //Method to return a value in a cell specified by i
        int itemAt(int i);

        //Method to assign a value to a cell specified by i
        int itemAt(int i, int nVal);

        //Method to display the contents of the vector
        void display();







};

#endif // INTVECTOR_H_DEFINED 
Correct me if I'm wrong but...I see no problem in your post

Those are some pretty neat class specifications though.
Probably seems neat because the class definition might have been provided already. What are the problems with your function definitions? I hope you did not expect somebody to write out all the code for you.
Topic archived. No new replies allowed.