Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- conversion constructor
- virtual function
- c++ multi chatting room
- virtual inheritance
- vector capacity
- discord bot
- placement new
- C++
- return by reference
- delete function
- c++ basic practice
- pointer to member data
- std::endl
- diamond inheritance
- new&delete
- base from member
- suffix return type
- member function pointer
- this call
- std::ostream
- std::vector
- virtual function table
- operator overloading
- std::cout
- 더 지니어스 양면포커
- dynamic_cast
- vector size
- virtual destructor
- constructor
- increment operator
Archives
- Today
- Total
목록UpCasting (1)
I'm FanJae.

※ 본 포스트는 코드누리 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)인..
C++/Basic
2024. 8. 21. 15:48