This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const int i = 3; | |
const_cast<int&>(i) = 4; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CBase | |
{ | |
public: | |
virtual void Print() = 0; // pure virtual, abstract | |
}; | |
class CDerived0 : public CBase | |
{ | |
public: | |
CDerived0() { puts("new0"); } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CCar | |
{ | |
class CWheel *pWheels[4]; // inline forward declaration | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int *i1 = new int; // 초기화안됨 | |
int *i2 = new int();// 됨 | |
int i3 = int(); // 됨 | |
int i4(0); // 됨 | |
int i5{0}; // 됨 | |
int i6(); // 컴파일에러 | |
cout << *i1 << ' ' << *i2 << ' '<< i3 << ' ' << i4 << ' ' << i5 << endl; | |
char *pArr1 = new char[10]; // 초기화안함 | |
char *pArr2 = new char[10](); // '\0' 으로 초기화 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
enum class EDay { Mon, Tue, Web, Thu, Fri, Sat, Sun }; | |
EDay day = EDay::Mon; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
unsigned char b = 0b1010; // 10 | |
int i = 1'000'000; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
thread_local int tls_ThreadID; | |
__declspec(thread) int tls_ThreadID_Old; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int x = 2; | |
constexpr int GetDays() { return 2018 * 365; } | |
constexpr int todayDays1 = GetDays() * 1; // OK | |
constexpr int todayDays2 = GetDays() * x; // CompileTime Error | |
const int todayDays = GetDays() * x; // OK, Runtime initialize | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using byte = unsigned char; // typedef unsigned char byte; | |
byte bByte = 0xFF; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace Level0 | |
{ | |
namespace Level1 | |
{ | |
int e_Year = 2018; | |
} | |
inline namespace Group1 | |
{ | |
int e_Month = 1; |