Bug: you cannot enter multiple words for any of the string arguments, for example author and title. It will make more sense to read full lines there, for example:
cout << endl << "Author: ";
getline(cin, author);
Please don't use using namespace std
(read this this).
This is ok though:
using std::cin;
using std::cout;
using std::endl;
using std::string;
But the best is to not do this at all, but use explicitly std::cout
when you need,
especially for common names like string
, which might easily conflict with other implementations. See also @Loki's comment.
Instead of #include <stdlib.h>
, write like this: #include <cstdlib>
.
But actually, as @Edward pointed out,
it would be better to remove this import,
and change the single exit(0)
statement to return 0
.
It's unusual to put spaces around ->
. This is more common:
this->author = author;
RlYear
is not a very good name. Use camelCase
for variable names in general.
For this variable, releaseYear
would be a better name.
You can simplify the constructor of Book
like this:
Book(string &author, string &title, bool rented) :
author(author), title(title), rented(rented) {}
Similarly, TechnicBook
like this:
TehnicBook(string &author, string &title, bool rented, int amount, string &language, int RlYear) :
Book(author, title, rented), head(NULL), language(language), amount(amount), RlYear(RlYear) {}
Lastly, although the title says "c++ polymorphism", there's no example of polymorphism in this code.
Bug: you cannot enter multiple words for any of the string arguments, for example author and title. It will make more sense to read full lines there, for example:
cout << endl << "Author: ";
getline(cin, author);
Please don't use using namespace std
(read this).
This is ok though:
using std::cin;
using std::cout;
using std::endl;
using std::string;
But the best is to not do this at all, but use explicitly std::cout
when you need,
especially for common names like string
, which might easily conflict with other implementations. See also @Loki's comment.
Instead of #include <stdlib.h>
, write like this: #include <cstdlib>
.
But actually, as @Edward pointed out,
it would be better to remove this import,
and change the single exit(0)
statement to return 0
.
It's unusual to put spaces around ->
. This is more common:
this->author = author;
RlYear
is not a very good name. Use camelCase
for variable names in general.
For this variable, releaseYear
would be a better name.
You can simplify the constructor of Book
like this:
Book(string &author, string &title, bool rented) :
author(author), title(title), rented(rented) {}
Similarly, TechnicBook
like this:
TehnicBook(string &author, string &title, bool rented, int amount, string &language, int RlYear) :
Book(author, title, rented), head(NULL), language(language), amount(amount), RlYear(RlYear) {}
Lastly, although the title says "c++ polymorphism", there's no example of polymorphism in this code.
Bug: you cannot enter multiple words for any of the string arguments, for example author and title. It will make more sense to read full lines there, for example:
cout << endl << "Author: ";
getline(cin, author);
Please don't use using namespace std
(read this).
This is ok though:
using std::cin;
using std::cout;
using std::endl;
using std::string;
But the best is to not do this at all, but use explicitly std::cout
when you need,
especially for common names like string
, which might easily conflict with other implementations. See also @Loki's comment.
Instead of #include <stdlib.h>
, write like this: #include <cstdlib>
.
But actually, as @Edward pointed out,
it would be better to remove this import,
and change the single exit(0)
statement to return 0
.
It's unusual to put spaces around ->
. This is more common:
this->author = author;
RlYear
is not a very good name. Use camelCase
for variable names in general.
For this variable, releaseYear
would be a better name.
You can simplify the constructor of Book
like this:
Book(string &author, string &title, bool rented) :
author(author), title(title), rented(rented) {}
Similarly, TechnicBook
like this:
TehnicBook(string &author, string &title, bool rented, int amount, string &language, int RlYear) :
Book(author, title, rented), head(NULL), language(language), amount(amount), RlYear(RlYear) {}
Lastly, although the title says "c++ polymorphism", there's no example of polymorphism in this code.
Bug: you cannot enter multiple words for any of the string arguments, for example author and title. It will make more sense to read full lines there, for example:
cout << endl << "Author: ";
getline(cin, author);
Please don't use using namespace std
(read this).
This is ok though:
using std::cin;
using std::cout;
using std::endl;
using std::string;
But the best is to not do this at all, but use explicitly std::cout
when you need,
especially for common names like string
, which might easily conflict with other implementations. See also @Loki's comment @Loki's comment.
Instead of #include <stdlib.h>
, write like this: #include <cstdlib>
.
But actually, as @Edward @Edward pointed out,
it would be better to remove this import,
and change the single exit(0)
statement to return 0
.
It's unusual to put spaces around ->
. This is more common:
this->author = author;
RlYear
is not a very good name. Use camelCase
for variable names in general.
For this variable, releaseYear
would be a better name.
You can simplify the constructor of Book
like this:
Book(string &author, string &title, bool rented) :
author(author), title(title), rented(rented) {}
Similarly, TechnicBook
like this:
TehnicBook(string &author, string &title, bool rented, int amount, string &language, int RlYear) :
Book(author, title, rented), head(NULL), language(language), amount(amount), RlYear(RlYear) {}
Lastly, although the title says "c++ polymorphism", there's no example of polymorphism in this code.
Bug: you cannot enter multiple words for any of the string arguments, for example author and title. It will make more sense to read full lines there, for example:
cout << endl << "Author: ";
getline(cin, author);
Please don't use using namespace std
(read this).
This is ok though:
using std::cin;
using std::cout;
using std::endl;
using std::string;
But the best is to not do this at all, but use explicitly std::cout
when you need,
especially for common names like string
, which might easily conflict with other implementations. See also @Loki's comment.
Instead of #include <stdlib.h>
, write like this: #include <cstdlib>
.
But actually, as @Edward pointed out,
it would be better to remove this import,
and change the single exit(0)
statement to return 0
.
It's unusual to put spaces around ->
. This is more common:
this->author = author;
RlYear
is not a very good name. Use camelCase
for variable names in general.
For this variable, releaseYear
would be a better name.
You can simplify the constructor of Book
like this:
Book(string &author, string &title, bool rented) :
author(author), title(title), rented(rented) {}
Similarly, TechnicBook
like this:
TehnicBook(string &author, string &title, bool rented, int amount, string &language, int RlYear) :
Book(author, title, rented), head(NULL), language(language), amount(amount), RlYear(RlYear) {}
Lastly, although the title says "c++ polymorphism", there's no example of polymorphism in this code.
Bug: you cannot enter multiple words for any of the string arguments, for example author and title. It will make more sense to read full lines there, for example:
cout << endl << "Author: ";
getline(cin, author);
Please don't use using namespace std
(read this).
This is ok though:
using std::cin;
using std::cout;
using std::endl;
using std::string;
But the best is to not do this at all, but use explicitly std::cout
when you need,
especially for common names like string
, which might easily conflict with other implementations. See also @Loki's comment.
Instead of #include <stdlib.h>
, write like this: #include <cstdlib>
.
But actually, as @Edward pointed out,
it would be better to remove this import,
and change the single exit(0)
statement to return 0
.
It's unusual to put spaces around ->
. This is more common:
this->author = author;
RlYear
is not a very good name. Use camelCase
for variable names in general.
For this variable, releaseYear
would be a better name.
You can simplify the constructor of Book
like this:
Book(string &author, string &title, bool rented) :
author(author), title(title), rented(rented) {}
Similarly, TechnicBook
like this:
TehnicBook(string &author, string &title, bool rented, int amount, string &language, int RlYear) :
Book(author, title, rented), head(NULL), language(language), amount(amount), RlYear(RlYear) {}
Lastly, although the title says "c++ polymorphism", there's no example of polymorphism in this code.
Bug: you cannot enter multiple words for any of the string arguments, for example author and title. It will make more sense to read full lines there, for example:
cout << endl << "Author: ";
getline(cin, author);
Please don't use using namespace std
(read this).
This is ok though:
using std::cin;
using std::cout;
using std::endl;
using std::string;
But the best is to not do this at all, but use explicitly std::cout
when you need,
especially for common names like string
, which might easily conflict with other implementations. See also @Loki's comment .
Instead of #include <stdlib.h>
, write like this: #include <cstdlib>
.
But actually, as @Edward pointed out,
it would be better to remove this import,
and change the single exit(0)
statement to return 0
.
It's unusual to put spaces around ->
. This is more common:
this->author = author;
RlYear
is not a very good name. Use camelCase
for variable names in general.
For this variable, releaseYear
would be a better name.
You can simplify the constructor of Book
like this:
Book(string &author, string &title, bool rented) :
author(author), title(title), rented(rented) {}
Similarly, TechnicBook
like this:
TehnicBook(string &author, string &title, bool rented, int amount, string &language, int RlYear) :
Book(author, title, rented), head(NULL), language(language), amount(amount), RlYear(RlYear) {}
Lastly, although the title says "c++ polymorphism", there's no example of polymorphism in this code.
Bug: you cannot enter multiple words for any of the string arguments, for example author and title. It will make more sense to read full lines there, for example:
cout << endl << "Author: ";
getline(cin, author);
Please don't use using namespace std
(read this).
This is ok though:
using std::cin;
using std::cout;
using std::endl;
using std::string;
Instead of #include <stdlib.h>
, write like this: #include <cstdlib>
.
But actually, as @Edward pointed out,
it would be better to remove this import,
and change the single exit(0)
statement to return 0
.
It's unusual to put spaces around ->
. This is more common:
this->author = author;
RlYear
is not a very good name. Use camelCase
for variable names in general.
For this variable, releaseYear
would be a better name.
You can simplify the constructor of Book
like this:
Book(string &author, string &title, bool rented) :
author(author), title(title), rented(rented) {}
Similarly, TechnicBook
like this:
TehnicBook(string &author, string &title, bool rented, int amount, string &language, int RlYear) :
Book(author, title, rented), head(NULL), language(language), amount(amount), RlYear(RlYear) {}
Lastly, although the title says "c++ polymorphism", there's no example of polymorphism in this code.
Bug: you cannot enter multiple words for any of the string arguments, for example author and title. It will make more sense to read full lines there, for example:
cout << endl << "Author: ";
getline(cin, author);
Please don't use using namespace std
(read this).
This is ok though:
using std::cin;
using std::cout;
using std::endl;
using std::string;
But the best is to not do this at all, but use explicitly std::cout
when you need,
especially for common names like string
, which might easily conflict with other implementations. See also @Loki's comment .
Instead of #include <stdlib.h>
, write like this: #include <cstdlib>
.
But actually, as @Edward pointed out,
it would be better to remove this import,
and change the single exit(0)
statement to return 0
.
It's unusual to put spaces around ->
. This is more common:
this->author = author;
RlYear
is not a very good name. Use camelCase
for variable names in general.
For this variable, releaseYear
would be a better name.
You can simplify the constructor of Book
like this:
Book(string &author, string &title, bool rented) :
author(author), title(title), rented(rented) {}
Similarly, TechnicBook
like this:
TehnicBook(string &author, string &title, bool rented, int amount, string &language, int RlYear) :
Book(author, title, rented), head(NULL), language(language), amount(amount), RlYear(RlYear) {}
Lastly, although the title says "c++ polymorphism", there's no example of polymorphism in this code.