So I'm doing a little class assignment and I've ran into a little problem. My teacher in all of his source files declares all his method signatures all at once at the top of his class. However when I tried to do that I get a compiler error. Here's the source:
The way you are doing it is declaring two equals functions with the same argument lists. You want to write a function prototype, then implement the function definition in a .cpp file.
Account.hpp
1 2 3 4 5 6 7 8
class Account
{
//your member functions go *inside* the class declaration
public:
//...
bool equals(Account) const;
//...
};
Account.cpp
1 2 3 4 5 6 7 8
//then in a seperate .cpp file you write the definitions:
#include "Account.h"
//...
bool Account::equals(Account accountIn) const
{
return (accountIn.getName().compare(accountName) == 0);
}
//...
just like the sock monster in everyones laundry room who steals socks so you only have one matching sock there is also a semicolon goblin. he steals semicolons.