Confused!
I'm doing the tutorial TheNewBoston made. I'm currently at "Introduction to Classes and Objects".
My problem is i really like prototypes to keep it "clean" (at least in my head) so when i try follow his instructions but with a prototype implemented, it wont work??
Heres the code of the one that wont work.
It has the error "aggregate 'AClass aObject' has incomplete type and cannot be defined":
Otherwise, you'll have to put the class definition at the top, before main.
If you typically define your member functions inside of the class definition, you can shave off a little room from the top by moving those definitions below main:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
#include <iostream>
class AClass
{
public:
void blah();
};
int main()
{
AClass a;
a.blah();
}
void AClass::blah() // If using multiple files, this would typically go in a separate .cpp file
{
std::cout << "Blah!";
}