Hi,
The class news has the
vector<unique_ptr<Account>> like;
, so you can't push_back like you do here:
1 2 3
|
void Social::addNews(const News& news){
this->news.push_back(news);
}
|
So I was saying you need to move it instead.
Why protected data is bad as public data?.. encapsulation does not make sense then.. |
Encapsulation works with private data. The main reason protected data is bad is that it's not a function, which means that it's easy to break code if the representation of the data changes.
I studied that const in parameters means that u will not modify that parameter, so compiler doesn't allocate other space (something like that). |
The
const
is fine, I am saying is
not necessary to have it in the declaration, but
do have it in the definition:
User(const string &username, const string &name, const string &surname, const string &address, const string &date);
User::User(const string &username, const string &name, const string &surname, const string &address, const string &date);
The reason for this is that a user of the code, seeing the header file only, might think they have to make to make an argument
const
, which isn't necessary. Don't worry I too did that for ages before I found out.
std:: is so uncomfortable using namespace std has been created for that.. or not? xD |
That is a very common misconception for people new to C++. The main problem is clashes with function and variable names - which namespaces are supposed prevent ! :+) that
using
statement subverts that. There is loads of info on the internet about that very thing. That's why I also mentioned putting your code in it's own namespace.
It's tough coming from another OOP language like Java, which could be seen as been kind of similar to C++, but not really. Hopefully you can add the things I mentioned and get some extra points for your assignment.