1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include <iostream>
#include <string>
using namespace std;
 
class Book {
    string title;
    int price, pages;
public:
    Book(string title = ""int price = 0int pages = 0) {
        this->title = title; this->price = price; this->pages = pages;
    }
    void show() {
        cout << title << ' ' << price << "원 " << pages << " 페이지" << '\n';
    }
    string getTitle() { return title; }
    bool operator!();
};
 
bool Book::operator!() {
    if (price == 0return true;
    else return false;
}
 
int main() {
    Book book("벼룩시장"050);
    if (!book) cout << "꽁짜다" << '\n';
}
cs


+ Recent posts