Created
June 16, 2016 14:04
-
-
Save boldijar/86fba58f439eef83fbac30902cfbdbae 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: | |
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; | |
cout << g.getSize(); | |
int b; | |
cin >> b; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment