C++/설명 범범조조 2016. 4. 19. 21:03
-특별한 멤버 this//this 는 있는 멤버이고 정적인 멤버입니다.//::스코프 연산자#include using namespace std; int num = 1; class Demo{ int num;public: Demo(int num) { this->num = num; } void View(int num)const { cout
더 읽기
-캡슐화 개요 #include #include using namespace std; class Unit //class 대신 struct 써도 오류는 안난다. 접근 지정을 최소하 하자!!!!!!!!!!!{ //클래스의 디폴트 가시성은 private //구조체의 디폴트 가시성은 public int num; string name; int hp;public://클래스 외부에서도 접근 가능할 수 있게 접근 지정사 설정 Unit(int _num, string _name) { num = _num; name = _name; hp = 100; } void Train(int hour)//멤버 메서드 { cout> n; int *darr = new int[n]; //배열 스러운거지 배열 생성자 아니다. for(int i =..
C++/설명 범범조조 2016. 4. 19. 20:59
//string 형식 개요#include #include using namespace std; int main(void){ string s = "hello"; string s2 = "hello"; string s3; if(s == s2) { cout