반응형

2016/12/18 6

[C++ 소스] 의존(DEPENDENCY) 관계, 공장과 상품

[C++ 소스] 의존(DEPENDENCY) 관계, 공장과 상품 //Product.h#pragma once#include #include using namespace std;class Product{ string name; int price; const int pnum;public: Product(string name,int price,int pnum); void View()const; }; //Product.cpp#include "Product.h" Product::Product(string name,int price,int pnum):pnum(pnum){ this->name = name; this->price = price;}void Product::View()const{ coutView(); Prod..

C++/디딤돌 C++ 2016.12.18

[C++ 소스] 직접 연관(DIRECTED ASSOCIATION) 관계, 회사와 직원

[C++ 소스] 직접 연관(DIRECTED ASSOCIATION) 관계, 회사와 직원"회사는 직원의 집합체이며 회사는 직원에게 명령을 내릴 수 있다."회사와 직원은 집합 관계이면서 직접 연관 관계이다. //Worker.h#pragma once#include #include using namespace std;class Worker{ string name;public: Worker(string name); void Work(); string GetName()const; }; //Worker.cpp#include "Worker.h"Worker::Worker(string name){ this->name = name;}void Worker::Work(){ coutInWorker(new Worker("강감찬"))..

C++/디딤돌 C++ 2016.12.18

[C++ 소스] 집합 관계(Aggregation Relation), 필통과 연필

[C++ 소스] 집합 관계(Aggregation Relation), 필통과 연필 //Pencil.h#pragma once#include #include using namespace std;class Pencil{ string company; int price; public: Pencil(string company,int price); string GetCompany()const; int GetPrice()const; }; //Pencil.cpp#include "Pencil.h" Pencil::Pencil(string company,int price){ this->company = company; this->price = price;}string Pencil::GetCompany()const{ return..

C++/디딤돌 C++ 2016.12.18
반응형