Hello I am learning c++ right now but I dont find an answer to my error.
The Problem is k.testLogin(); and produces the Error: [Error] request for member 'testLogin' in 'k', which is of pointer type 'Konto*' (maybe you meant to use '->' ?)
The function testLogin() from Konto looks like this and is public:
void testLogin()
{
(empty right now because doesnt work)
}
Konstruktor of Konto:
Konto(char response)
{
switch(response)
{
case ('1'): neuesKonto(); cout<<"
Konto wurde erstellt!";break;
case ('2'): logIn();break;
default: cout<<"
Falsche Eingabe!";break;
}
}
this is my main:
Konto* k;
bool loggedIn;
int main() {
srand(0);
do
{
cout <<"Bankkonten verwalten und erstellen...
";
cout <<"--- 1 = neuesKonto --- 2 = LOG-IN ---
";
cout <<"Eingabe: ";
char response;
std::cin >> response;
k = new Konto(response);
k.testLogin();
}while(loggedIn == true);
return 0;
}
Everything works I only cant run k.testLogin(); ...
Thank you for help... Konto.h is kinda big so I dont post it here if not needed.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…