Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #ifndef ARRAYTEMPLATE_H
- #define ARRAYTEMPLATE_H
- #include <iostream>
- using namespace std;
- template <class T>
- class ArrayTemplate;
- template <class T>
- ostream& operator<< (ostream& os, ArrayTemplate<T>& a);
- template <class T>
- class ArrayTemplate
- {
- private:
- T* data;
- int cap;
- int br;
- public:
- ArrayTemplate(int c);
- ArrayTemplate(const ArrayTemplate<T>& a);
- virtual ~ArrayTemplate();
- ArrayTemplate<T>& operator=(const ArrayTemplate<T>& a);
- T& operator[](int index);
- bool operator==(const ArrayTemplate<T>& a);
- int getCap() const{return this->cap;}
- int getBr()const {return this->br;}
- template <class J>
- friend ostream& operator<< (ostream& os, ArrayTemplate<J>& a)
- {
- os<< "Broj Elemenata: "<<a.getBr()<< " Kapacitet: " << a.getCap()<<endl;
- for(int i=0; i < a.getBr(); i++)
- {
- os <<a[i]<< " ";
- }
- // os << endl;
- return os;
- }
- void Dodaj(T newElem);
- };
- #include "ArrayTemplate.cpp"
- #endif // ARRAYTEMPLATE_H
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement