#include <iostream> #include "Vector.h" #include "String.h" #include "HashTable.h" using namespace std; int main() { Vector v{ 1, 2, 3 }; cout << v[-1] << endl; // 1 cout << v[0] << endl; // 1 cout << v[1] << endl; // 2 cout << v[2] << endl; // 3 cout << v[3] << endl; // 3 v[0] = 100; cout << v[0] << endl; const Vector cv{ 1, 2, 3 }; cout << cv[-1] << endl; // 1 cout << cv[0] << endl; // 1 cout << cv[1] << endl; // 2 cout << cv[2] << endl; // 3 cout << cv[3] << endl; // 3 String s("abc"); cout << s << endl; cout << s[0] << endl; cout << s[1] << endl; cout << s[2] << endl; s[0] = 'd'; cout << s << endl; cout << s[0] << endl; HashTable hashTable; hashTable["abc"] = "def"; cout << hashTable["abc"] << endl; hashTable["abc"] = "123"; cout << hashTable["abc"] << endl; hashTable["cba"] = "456"; cout << hashTable["cba"] << endl; cout << hashTable["abc"] << endl; } | cs |
'::public > C++' 카테고리의 다른 글
변환 연산자 오버로딩, 변환 생성자 (0) | 2020.11.23 |
---|---|
대입 연산자 오버로딩, 복사 생성자 (0) | 2020.11.23 |
비트 연산자 오버로딩 (0) | 2020.11.23 |
논리 연산자 오버로딩 (0) | 2020.11.23 |
비교&관계 연산자 오버로딩 (0) | 2020.09.23 |