2022/01/04 2

[C++언어]Class의 Protected 수정, 출력하여 사용하는 법 (예제 포함)

목차 [C++언어]Class의 Protected 수정, 출력하여 사용하는 법 앞서 포스트에서 상속(Inheritance)에 대해 알아 보았습니다. https://scribblinganything.tistory.com/435 [C++언어] 상속이란? 예제로 살펴보기(Inheritance) 목차 [C++언어] 상속이란? 상속이란 부모 클래스(Base Class)와 자식 클래스(Derived Class) 두개의 클래스가 있을 때 자식 클래스에서 부모 클래스의 method 나 attribute를 물려 받아서 동일하게 가지는 것 scribblinganything.tistory.com 이번에는 상속을 사용해서 Protected로 보호되고 있는 값을 불러오거나 수정하는 방법에 대해 알아 보겠습니다. protected..

[C++언어] 상속이란? 예제로 살펴보기(Inheritance)

목차 [C++언어] 상속이란? 상속이란 부모 클래스(Base Class)와 자식 클래스(Derived Class) 두개의 클래스가 있을 때 자식 클래스에서 부모 클래스의 method 나 attribute를 물려 받아서 동일하게 가지는 것을 의미 합니다. 상속은 : (콜론)을 사용해서 전달 합니다. : (콜론)으로 상속 정의 정의된 클래스의 속성과 메소드를 가져옴 [C++언어] 상속 예제 코드>> #include #include using namespace std; class family { public: string address = "Seoul"; }; class son : public family { public: int olds = 16; }; int main() { son James; cout