일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
- c++ multi chatting room
- virtual function table
- vector size
- member function pointer
- this call
- virtual inheritance
- discord bot
- c++ basic practice
- virtual function
- conversion constructor
- new&delete
- placement new
- suffix return type
- dynamic_cast
- constructor
- vector capacity
- 더 지니어스 양면포커
- increment operator
- virtual destructor
- std::endl
- pointer to member data
- base from member
- C++
- std::vector
- delete function
- return by reference
- diamond inheritance
- std::ostream
- operator overloading
- std::cout
- Today
- Total
목록2024/08/21 (2)
I'm FanJae.

※ 본 포스트는 코드누리 C++ Basic 강의 내용을 보고 정리한 포스트입니다. 1. 추상 클래스(Abstract class)class Shape{public: virtual ~Shape() {} virtual void draw() = 0;};int main(){ Shape s; // error Shape* p; // ok }- draw() 처럼 구현이 없고, =0 으로 끝나는 가상 함수를 Pure Virtual Function(순수 가상 함수)라고 한다.- 이러한 순수 가상함수가 한 개 이상 있는 클래스를 추상 클래스라고 한다. 1-1. 추상 클래스의 특징- 객체를 생성할 수 없다.- 포인터 변수는 만들 수 있다. 1-2. 추상 클래스로 부터 파생된 클래스class ..

※ 본 포스트는 코드누리 C++ Basic 강의 내용을 보고 정리한 포스트입니다. 1. UpCasting#include class Animal{ std::string name; int age;public: void cry() { }};class Dog : public Animal{ int color;public: void setColor(int c) { color = c; }};int main(){ Dog dog; Dog* p1 = &dog; // ok // int* p2 = &dog; // Error Animal* p3 = &dog;}- UpCasting이란, 기반 클래스 포인터로 파생 클래스 객체를 가리키는 행위를 의미한다.- 메모리 레이아웃 차원에서 보면, 파생 클래스(Derived Class)인..