본문 바로가기

전체 글332

첨자 연산자 오버로딩 #include #include "Vector.h"#include "String.h"#include "HashTable.h" using namespace std; int main(){ Vector v{ 1, 2, 3 }; cout 2020. 11. 23.
비트 연산자 오버로딩 #include #include using namespace std; class Vector{private: int x; int y; int z; public: Vector() { } Vector(int x, int y, int z) :x(x), y(y), z(z) { } friend ostream& operator 2020. 11. 23.
논리 연산자 오버로딩 #pragma warning(disable: 4996)#include #include using namespace std; class String{private: char* _chars; public: String(const char* chars) : _chars(new char[strlen(chars) + 1]) { strcpy(_chars, chars); } bool operator!() const { return strlen(_chars) == 0; } bool operator||(bool b) const { return strlen(_chars) > 0 || b; }}; bool func(){ cout 2020. 11. 23.
AI AI 에셋 Behavior Tree ; 행동 트리. AI에 알맞게 행동하도록 다양한 테스크들 간에 연결이 이뤄짐. 주로 사용하는 유형은 두가지. Composites : 행동 트리 가지 중 하나, 즉 어떤 태스크를 실행할지 선택함. Decorators : 서비스나 태스크와 같은 역할. 기능을 부여할 수 있는 컴포짓 추가 가능. BTTask ; 행동 트리 태스크 유형(BTTask, Behavior Tree Task)의 블루 프린트는 AI가 수행할 작업을 나타냄. BTService ; BTTask와 거의 동일한 기능 + 실행 시간 내내 호출됨. Blackboard ; 데이터 저장소. 2020. 11. 18.
비교&관계 연산자 오버로딩 #pragma warning(disable : 4996) #include #include using namespace std; class String{private: char* _chars; public: String(const char* chars) : _chars(new char[strlen(chars) + 1]) { strcpy(_chars, chars); } bool operator==(const String& s) const { return strcmp(_chars, s._chars) == 0; } bool operator!=(const String& s) const { return !(*this == s); } bool operator 0; } bool operator>=(const Strin.. 2020. 9. 23.
연산자 오버로딩 #include using namespace std; class Vector{public: float x; float y; float z; // 단항 연산자 +, +vector = vector Vector operator+() const { return Vector{ +x, +y, +z }; } // 단항 연산자 -, -vector = vector Vector operator-() const { return Vector{ -x, -y, -z }; } // 이항 연산자 +, vector + vector = vector Vector operator+(const Vector& v) const { return Vector{ x + v.x, y + v.y, z + v.z }; } // 이항 연산자 -, vecto.. 2020. 9. 15.