Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * DynArray.h
- */
- #include <cstdlib>
- #include <iostream>
- using namespace std;
- class DynArray;
- ostream& operator << (ostream&, DynArray&);
- istream& operator >> (istream&, LDynArray&);
- //...
- class DynArray {
- friend ostream& operator << (ostream&, DynArray&);
- friend istream& operator >> (istream&, DynArray&);
- public:
- /*
- Shorthand append
- */
- void operator += (T);
- /*
- Successfully sets a value
- from the list (shorthand set(int, T))
- */
- int& operator [](const int);
- /*
- Successfully gets a value
- from the list (shorthand get(int))
- */
- int operator [](const int) const;
- /*
- Reference assignment
- */
- void operator =(LinkedList&);
- //...
- };
- /*
- * DynArray.cpp
- */
- //// ... stuff ...
- /**********************/
- /* Operator Overloads */
- /**********************/
- void DynArray::operator = (DynArray& l) {
- // implementation
- }
- void DynArray::operator += (T val) {
- // implementation
- }
- int& // set
- DynArray::operator [] (const int i) {
- return this->get(i)->value;
- }
- int // get
- DynArray::operator [] (const int i) const {
- return this->get(i)->value;
- }
- /***** Insertion and Extraction *****/
- ostream& operator << (ostream &os, DynArray &list) {
- // implementation
- }
- istream& operator >> (istream &is, DynArray &list) {
- //implementation
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement