Jul 28, 2015 03:59 PM
(This post was last modified: Jul 28, 2015 04:03 PM by Nicktron.)
So I just recently started learning c++, right now I am learning about classes.
My error: function "AccountManager::registerAccount" (declared at line 15) is inaccessible
My code:
Would really appreciate some help on this! :)
Edit: Do I need to prototype classes like you do with functions? If so, how do I do it? :p
My error: function "AccountManager::registerAccount" (declared at line 15) is inaccessible
My code:
Code
#include <iostream>
#include <string>
using namespace std;
int Main() {
AccountManager AM;
AM.registerAccount("Mik", "Pwd");
}
class AccountManager {
string Username;
string Password;
void registerAccount(string User, string Pass) {
Username = User;
Password = Pass;
}
string loginAccount(string User, string Pass) {
if (User == Username) {
if (Pass == Password) {
return "Success";
}
else {
return "Error";
}
}
else {
return "Error";
}
}
};Would really appreciate some help on this! :)
Edit: Do I need to prototype classes like you do with functions? If so, how do I do it? :p

