Reputation: 33
litte question:
here is the class:
class Author
{
Author(const std::string& name, const std::string& email, Gender gender);
Author& setName(const std::string& name);
private:
std::string a_name;
std::string a_email;
int a_gender;
}
and i don't know why, he is write the next error:
error: 'Author::Author(const string&, const string&, Gender)' is private|
but it is defently constructor, so what is privet for him so he can't get acsses?
tanks!
Upvotes: 2
Views: 987
Reputation: 14695
Access in a class
defaults to private:
, not public:
.
This:
class Author
{
Author(const std::string& name, const std::string& email, Gender gender);
Author& setName(const std::string& name);
Should be:
class Author
{
public:
Author(const std::string& name, const std::string& email, Gender gender);
Author& setName(const std::string& name);
Upvotes: 6