전체 글 copy constructor - why const class & format? #include "stdafx.h"#include #include using namespace std; void PrintString(const string &str){cout 카테고리 없음 2018. 2. 3. class function and when copy constructor called #include "stdafx.h"#include #include using namespace std; class MyClass {public:MyClass() { }MyClass(const MyClass ©){cout 카테고리 없음 2018. 2. 3. constructor with reference (copy constructor) #include "stdafx.h"#include #include using namespace std; class String{private:char *str;int len; public:String();String(const char *str);String(const String ©); const char *c_str(); void Release();}; int main(){String str1 = "String";String str2 = str1; cout 카테고리 없음 2018. 2. 3. constructor with pointer #include "stdafx.h"#include #include using namespace std; class String{private:char *str;int len; public:String();String(const char *str); const char *c_str(); //void Release();}; int main(){String str1 = "String";String str2; str2 = str1; cout 카테고리 없음 2018. 2. 3. private constructor and public constructor #include "stdafx.h"#include #include using namespace std; class Class {private:Class *my; Class(); public: Class(int n);}; int main(){Class a;Class b(1); return 0;} 카테고리 없음 2018. 2. 3. class string simulation #include "stdafx.h"#include #include using namespace std; class mystring {private:char *c_str;unsigned int len; public:mystring(void);mystring(const char *str);const char *GetString();void Destroy();}; int main() { mystring str = "String";mystring empty; cout 카테고리 없음 2018. 2. 3. copy constructor #include "stdafx.h"#include #include using namespace std; class People {private:const string name;int age; public:People(const string &name) : name(name), age(19){cout 카테고리 없음 2018. 2. 3. class and constructor - initialization #include "stdafx.h"#include #include using namespace std; class People {private:const string name;int age; public:People() : name("Aumoa"), age(19){cout 카테고리 없음 2018. 2. 3. 이전 1 2 3 4 5 6 7 ··· 10 다음