Browse Source

Init

master
Mal 1 year ago
commit
a4010b5b33
  1. 1
      .gitignore
  2. 6
      Makefile
  3. 14
      template.cpp
  4. 13
      wtf.cpp
  5. 15
      wtf.hpp

1
.gitignore

@ -0,0 +1 @@
*.o

6
Makefile

@ -0,0 +1,6 @@
template: template.cpp wtf.o
g++ -o template template.cpp wtf.o
wtf.o: wtf.cpp wtf.hpp
g++ -o wtf.o -c wtf.cpp

14
template.cpp

@ -0,0 +1,14 @@
#include <iostream>
#include "wtf.hpp"
int main()
{
int number = 42;
Wtf<int> wtf(number);
std::cout << wtf.getTest() << std::endl;
return 0;
}

13
wtf.cpp

@ -0,0 +1,13 @@
#include "wtf.hpp"
template <typename T>
Wtf<T>::Wtf(T & test): test(test)
{
}
template <typename T>
T & Wtf<T>::getTest()
{
return this->test;
}

15
wtf.hpp

@ -0,0 +1,15 @@
#ifndef __WTF__
#define __WTF__
template <typename T>
class Wtf
{
T & test;
public:
Wtf(T & test);
T & getTest();
};
#endif
Loading…
Cancel
Save