728x90
#include <iostream>
#include <string>
using namespace std;

class Book
{
	string title;
	int price = 0;
public:
	Book(string title, int price) {
		this->title = title;
		this->price = price;
	}
	~Book() {};
	void set(string title, int price) {
		this->title = title;
		this->price = price;
	}
	void show() { cout << title << ' ' << price << "원" << endl; }
};


int main() {
	cout << "2018305065 전유정" << endl;

	Book cpp("명품 C++", 10000);
	Book java = cpp;
	java.set("명품자바", 12000);
	cpp.show();
	java.show();
}

반응형
  • 네이버 블러그 공유하기
  • 네이버 밴드에 공유하기
  • 페이스북 공유하기
  • 카카오스토리 공유하기