OK. I just don't understand what is the problem here. Here's the code
.h file :
#ifndef NVECTOR_H
#define NVECTOR_H
class Nvector
{
public:
//Nvector();
Nvector(int Size = 0);
void addElement(int a, int index);
void getElement(int index);
void push_me_back(int a);
void push_me_front(int a);
private:
int *p_array;
int velicina;
int *resize_array(int *p_val, int curr_size);
int *set_at_begin
int curr_index;
};
#endif // NVECTOR_H
impl file :
#include "Nvector.h"
#include <iostream>
using namespace std;
Nvector::Nvector(int Size) : velicina(Size);
{} // korisnik odredjuje velicinu vektora
void Nvector::addElement(int a,int index) {
if(index => velicina){ // obrati paznju prilikom compajliranja
p_array = resize_array(p_array, velicina)
}
p_array[index] = a;
curr_index = index;
}
void Nvector::getElement(int index) {
return p_array[index];
}
int * Nvector::resize_array(int *p_old_array, int curr_size){
int *p_new_array = new int[curr_size*2];
for(int i = 0;i < curr_size;i++){
p_new_array[i] = p_old_array[i];
}
delete [] p_old_array;
return p_new_array;
}
main file :
#include <iostream>
#include "Nvector.h"
using namespace std;
int main()
{
Nvector Vector(10);
Vector.addElement(3,0);
cout << Vector.getElement(0);
}
Error message is the tittle of the post on the line 9 in main file (Nvector Vector(10)). Please help, am dying in here