idk
This commit is contained in:
parent
cc53df2dab
commit
c06e72fca1
12
Makefile
12
Makefile
@ -1,27 +1,29 @@
|
|||||||
|
export BUILD_CMD=clang++ -Wall -std=c++17 -Wall -Wextra
|
||||||
|
|
||||||
setup:
|
setup:
|
||||||
mkdir build
|
mkdir build
|
||||||
|
|
||||||
sheet0:
|
sheet0:
|
||||||
g++ src/sheet0.cpp -o ./build/sheet0
|
${BUILD_CMD} src/sheet00.cpp -o build/sheet0
|
||||||
chmod +x build/sheet0
|
chmod +x build/sheet0
|
||||||
build/sheet0
|
build/sheet0
|
||||||
|
|
||||||
sheet01:
|
sheet01:
|
||||||
g++ src/sheet01.cpp -o ./build/sheet01
|
${BUILD_CMD} src/sheet01.cpp -o build/sheet01
|
||||||
chmod +x build/sheet01
|
chmod +x build/sheet01
|
||||||
build/sheet01
|
build/sheet01
|
||||||
|
|
||||||
sheet02:
|
sheet02:
|
||||||
g++ src/sheet02.cpp -o ./build/sheet02
|
${BUILD_CMD} src/sheet02.cpp -o build/sheet02
|
||||||
chmod +x build/sheet02
|
chmod +x build/sheet02
|
||||||
build/sheet02
|
build/sheet02
|
||||||
|
|
||||||
sheet03:
|
sheet03:
|
||||||
g++ src/sheet03.cpp -o ./build/sheet03
|
${BUILD_CMD} src/sheet03.cpp src/MyType.cpp -o build/sheet03
|
||||||
chmod +x build/sheet03
|
chmod +x build/sheet03
|
||||||
build/sheet03
|
build/sheet03
|
||||||
|
|
||||||
pizza:
|
pizza:
|
||||||
g++ src/pizza.cpp -o ./build/pizza
|
${BUILD_CMD} src/pizza.cpp -o build/pizza
|
||||||
chmod +x build/pizza
|
chmod +x build/pizza
|
||||||
build/pizza
|
build/pizza
|
||||||
|
@ -1,11 +1,9 @@
|
|||||||
#include "../headers/MyType.h"
|
#include "../headers/MyType.h"
|
||||||
#include <string>
|
#include <string>
|
||||||
std::string name;
|
#include <iostream>
|
||||||
unsigned age;
|
MyType::MyType(std::string n, unsigned a) : name(n), age(a) {std::cout << "ctor\n";}
|
||||||
|
MyType::~MyType() {std::cout << "dtor \n";}
|
||||||
MyType(std::string n, unsigned a) : name(n), age(a) {std::cout << "ctor\n";}
|
MyType::MyType(const MyType &t) { std::cout << "copy ctor\n";}
|
||||||
~MyType() {}
|
MyType& MyType::operator= (const MyType &t) { std::cout << "copy ass ctor\n"; return *this;}
|
||||||
MyType(const MyType &t) { std::cout << "copy ctor\n";}
|
MyType::MyType(MyType &&t){std::cout << "move ctor\n";}
|
||||||
MyType& operator= (const MyType &t) { std::cout << "copy ass ctor\n"; return *this;}
|
MyType& MyType::operator= (MyType &&t) { std::cout << "move ass ctor\n"; return t;}
|
||||||
MyType(MyType &&t){std::cout << "move ctor\n";}
|
|
||||||
MyType& operator= (MyType &&t) { std::cout << "move ass ctor\n"; return t;}
|
|
@ -2,8 +2,12 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include "../headers/MyType.h"
|
#include "../headers/MyType.h"
|
||||||
|
|
||||||
|
int calculate(const char &argv)
|
||||||
|
{
|
||||||
|
|
||||||
int main()
|
}
|
||||||
|
|
||||||
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
MyType j("jj", 69);
|
MyType j("jj", 69);
|
||||||
MyType cj(j);
|
MyType cj(j);
|
||||||
@ -12,5 +16,9 @@ int main()
|
|||||||
MyType mj(std::move(j));
|
MyType mj(std::move(j));
|
||||||
MyType maj("jj", 69);
|
MyType maj("jj", 69);
|
||||||
maj = std::move(cj);
|
maj = std::move(cj);
|
||||||
|
if(argc == 4)
|
||||||
|
{
|
||||||
|
calculate(argv);
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user