언어 정리/C++_개념_lib
typedef
알 수 없는 사용자
2024. 1. 3. 19:29
alias 개념
typedef typename std::string string;
이거나
typedef std::string string;
이거나 둘다 현재 상황에서는 동일함.
typedef std::string string; <- 이게 alias 개념으로만 쓰는 상황에 맞는 표현
#include <iostream>
#include <string>
using namespace std;
typedef typename std::string string;
int main()
{
char c = 'A';
// using std::string::operator+=
string sss="20";
cout << sss << endl;
string *str_ptr = new string("Initial string");
cout << *str_ptr << endl;
string str_ins;
str_ins = "AAAA";
cout << str_ins << endl;
return 0;
}