From c06e72fca1206310d953e4edc9d356f92f89b954 Mon Sep 17 00:00:00 2001 From: Leon Wilzer Date: Thu, 10 Nov 2022 10:41:51 +0100 Subject: [PATCH] idk --- Makefile | 12 +++++++----- src/MyType.cpp | 16 +++++++--------- src/sheet03.cpp | 12 ++++++++++-- 3 files changed, 24 insertions(+), 16 deletions(-) diff --git a/Makefile b/Makefile index 832c49d..65f48bc 100644 --- a/Makefile +++ b/Makefile @@ -1,27 +1,29 @@ + export BUILD_CMD=clang++ -Wall -std=c++17 -Wall -Wextra + setup: mkdir build sheet0: - g++ src/sheet0.cpp -o ./build/sheet0 + ${BUILD_CMD} src/sheet00.cpp -o build/sheet0 chmod +x build/sheet0 build/sheet0 sheet01: - g++ src/sheet01.cpp -o ./build/sheet01 + ${BUILD_CMD} src/sheet01.cpp -o build/sheet01 chmod +x build/sheet01 build/sheet01 sheet02: - g++ src/sheet02.cpp -o ./build/sheet02 + ${BUILD_CMD} src/sheet02.cpp -o build/sheet02 chmod +x build/sheet02 build/sheet02 sheet03: - g++ src/sheet03.cpp -o ./build/sheet03 + ${BUILD_CMD} src/sheet03.cpp src/MyType.cpp -o build/sheet03 chmod +x build/sheet03 build/sheet03 pizza: - g++ src/pizza.cpp -o ./build/pizza + ${BUILD_CMD} src/pizza.cpp -o build/pizza chmod +x build/pizza build/pizza diff --git a/src/MyType.cpp b/src/MyType.cpp index 2703aa5..3fa9b66 100644 --- a/src/MyType.cpp +++ b/src/MyType.cpp @@ -1,11 +1,9 @@ #include "../headers/MyType.h" #include - std::string name; - unsigned age; - - 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& operator= (const MyType &t) { std::cout << "copy ass ctor\n"; return *this;} - MyType(MyType &&t){std::cout << "move ctor\n";} - MyType& operator= (MyType &&t) { std::cout << "move ass ctor\n"; return t;} \ No newline at end of file +#include + MyType::MyType(std::string n, unsigned a) : name(n), age(a) {std::cout << "ctor\n";} + MyType::~MyType() {std::cout << "dtor \n";} + MyType::MyType(const MyType &t) { std::cout << "copy ctor\n";} + MyType& MyType::operator= (const MyType &t) { std::cout << "copy ass ctor\n"; return *this;} + MyType::MyType(MyType &&t){std::cout << "move ctor\n";} + MyType& MyType::operator= (MyType &&t) { std::cout << "move ass ctor\n"; return t;} \ No newline at end of file diff --git a/src/sheet03.cpp b/src/sheet03.cpp index af74888..55a6435 100644 --- a/src/sheet03.cpp +++ b/src/sheet03.cpp @@ -2,8 +2,12 @@ #include #include "../headers/MyType.h" +int calculate(const char &argv) +{ -int main() +} + +int main(int argc, char **argv) { MyType j("jj", 69); MyType cj(j); @@ -12,5 +16,9 @@ int main() MyType mj(std::move(j)); MyType maj("jj", 69); maj = std::move(cj); + if(argc == 4) + { + calculate(argv); + } return 0; -} \ No newline at end of file +}