-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path06_classi_esercitazione.cpp
More file actions
58 lines (38 loc) · 1.24 KB
/
Copy path06_classi_esercitazione.cpp
File metadata and controls
58 lines (38 loc) · 1.24 KB
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#include <iostream>
using namespace std;
class Library{
public:
Library() : id(-1), arr(NULL), book_count(0), shelf_size(0){}
Library(int _id, size_t _size) : id(_id), book_count(0), shelf_size(_size){this->arr = new Book[_size];}
bool add_Book(const Book& book){
if(this->book_count >= this->shelf_size)
return false;
this->arr[book_count] = book;
book_count++;
return true;
}
// *********************************************
private:
int id;
Book *arr;
int book_count;
int shelf_size;
};
class Book{
// (Sono una descrizione piu o meno breve della classe)
public:
Book() : title(""), author(""), id(0){}
Book(string _title, string _author, int _id) : title(_title), author(_author), id(_id){}
const string &get_title() const {return this->title;}
const string &get_author() const {return this->author;}
const int &get_id() const {return this->id;}
// ******************************
private:
string title;
string author;
int id;
};
int main(){
// *********************************************
return 0;
}