Cpp 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: ge=5; } void Complex::ShowComplex() { cout<<"( " <<real <<" + " <<image << "i )" <<endl ; } void main() { Complex x; x.real = 5 ; x.image = 10; x.ShowComplex(); } - 20 - IT COOKBOOK [실습하기 8-3] private 멤버를 다루기 위한 멤버함수 추가하기 [예제 8-3] 8_3.cpp 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 #include<iostream> using namespace std; class Complex { private : int real; int image; public : void SetComplex(); void ShowComplex(); void SetReal(int r); void SetImage(int i); }; void Complex::SetComplex() { real=2; image=5; } - 21 - IT COOKBOOK [실습하기 8-3] private 멤버를 다루기 위한 멤버함수 추가하기 [예제 8-3] 8_3.cpp 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 void Complex::ShowComplex() { cout<<"( " <<real <<" + " <<image << "i )" <<endl ; } void Complex::SetReal(int r) { real = r; } void Com...
View Full Document

This document was uploaded on 01/19/2014.

Ask a homework question - tutors are online