Category 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. class and constructor #include "stdafx.h"#include #include using namespace std; class People {private:const string name;int age; public:People() {cout 카테고리 없음 2018. 2. 3. class2 #include "stdafx.h"#include #include using namespace std; class Server {public:bool IsOverlapped(const string &id);}; class Account {private:Server server; string id = "myID";string password = "myPW";public:void SetServer(Server &server); bool Set(const string &id, const string &pw); bool QueryLog(const string &id, const string &pw);}; int main(){Server server;Account acc; acc.SetServer(server);.. 카테고리 없음 2018. 2. 3. 이전 1 2 3 4 5 6 7 ··· 9 다음