-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathBook.h
41 lines (32 loc) · 880 Bytes
/
Book.h
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
#define _CRT_SECURE_NO_WARNINGS
#ifndef BOOK_H
#define BOOK_H
#include <iostream>
#include <cstring>
using namespace std;
/*
Book Class
Protected member variables:
C-strings for title, ISBN, author, and publisher
Public member functions:
get and set for each member variable
*/
class Book
{
protected:
char title[100];
char isbn[11];
char author[30];
char publisher[20];
public:
Book();
char *getIsbn() { return isbn; }
char *getTitle() { return title; }
char *getAuthor() { return author; }
char *getPublisher() { return publisher; }
void setTitle(const char *t) { strncpy(title, t, 100); }
void setIsbn(const char *i) { strncpy(isbn, i, 16); }
void setAuthor(const char *a) { strncpy(author, a, 30); }
void setPublisher(const char *p) { strncpy(publisher, p, 20); }
};
#endif