Basicly I'm trying to translate Java's collections API ArrayList to a raw version in c++.
Code:
//ArrayList.h
#ifndef _ARRAYLIST_H_
#define _ARRAYLIST_H_
#include /*bla bla bla*/
#define ARRAYLIST_INITIALCAPACITY 128
class ArrayList: public Collection{
private:
void *elements;
unsigned int size;
public:
ArrayList(int initialCapacity = ARRAYLIST_INITIALCAPACITY);
ArrayList(Collection other);
~ArrayList();
ArrayList& operator=(const ArrayList& arr);
//methods here...
};
#endif //_ARRAYLIST_H_
//ArrayList.cpp
#include "ArrayList.h"
ArrayList::ArrayList(int initialCapacity){
elements = new void[initialCapacity];
}
ArrayList::ArrayList(Collection other){}
ArrayList::~ArrayList(){
//delete[] elements;
//size=0;
}
ArrayList& ArrayList::operator=(const ArrayList& arr){}
//more stuff here
I'm getting these error with MSVC++ 6... I'm sick of trying to understand what's going on... Bah!!Please help
Code:
ArrayList.cpp(3) : error C2535: '__thiscall ArrayList::ArrayList(int)' : member function already defined or declared
arraylist.h(19) : see declaration of 'ArrayList::ArrayList'
ArrayList.cpp(6) : error C2535: '__thiscall ArrayList::ArrayList(class Collection)' : member function already defined or declared
arraylist.h(20) : see declaration of 'ArrayList::ArrayList'
ArrayList.cpp(7) : error C2535: '__thiscall ArrayList::
//same errors for operator= and ~ArrayList()
ArrayList.cpp(13) : fatal error C1004: unexpected end of file found
teste.cpp
Thanks in advance.