Created
June 17, 2016 06:22
-
-
Save boldijar/44e42fb32cd6a04eb9de823b4fb79a4f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// invat_pt_scris.cpp : Defines the entry point for the console application. | |
// | |
#include <iostream> | |
#include <string> | |
#include <vector> | |
#include <assert.h> | |
template <class T> | |
class grades | |
{ | |
public: | |
// AICI | |
T *begin() { return g; } | |
T *end() { return g + size; } | |
// | |
T g[100]; | |
int size = 0; | |
grades() :size(0) {} | |
grades operator+(T grade) { | |
grades newG(*this); | |
newG.g[newG.size] = grade; | |
newG.size++; | |
return newG; | |
} | |
int getSize() { | |
return this->size; | |
} | |
}; | |
using namespace std; | |
int main() { | |
grades<int> g; | |
g = g + 1; | |
g = g + 2; | |
for (int nr : g) | |
{ | |
cout << nr << endl; | |
} | |
cout << "SIZE: "<<g.getSize(); | |
int b; | |
cin >> b; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment