Namespaces
Variants

C++ keyword: class

From cppreference.net
C++ language
General topics
Flow control
Conditional execution statements
Iteration statements (loops)
Jump statements
Functions
Function declaration
Lambda function expression
inline specifier
Dynamic exception specifications ( until C++17* )
noexcept specifier (C++11)
Exceptions
Namespaces
Types
Specifiers
constexpr (C++11)
consteval (C++20)
constinit (C++20)
Storage duration specifiers
Initialization
Expressions
Alternative representations
Literals
Boolean - Integer - Floating-point
Character - String - nullptr (C++11)
User-defined (C++11)
Utilities
Attributes (C++11)
Types
typedef declaration
Type alias declaration (C++11)
Casts
Memory allocation
Classes
Class-specific function properties
Special member functions
Templates
Miscellaneous

사용법

(C++11부터)

예제

class Foo; // 클래스의 전방 선언
class Bar  // 클래스 정의
{
public:
    Bar(int i) : m_i(i) {}
private:
    int m_i;
};
template<class T> // 템플릿 인자
void qux()
{
    T t;
}
enum class Pub // 범위가 지정된 열거형, C++11부터
{
    b, d, p, q
};
int main()
{
    Bar Bar(1); // 변수 Bar가 타입 Bar를 가림
    Bar Bar2(2); // 컴파일러 오류
    class Bar Bar3(3); // 정교화된 타입
}

참고 항목

(C++11부터)
(C++20부터)