Trouble with Variables in Classes

I'm doing tutorials on C++ and got to "Variables in Classes"..

I keep getting the error "1.cpp |25| error: no match for 'operator<<' (operand types are 'std::ostream {aka std::basic_ostream<char>}' and '<unresolved overloaded function type>')|

It makes no sence to me, because from what i can see its the exact same as the tutorial but with slight changes on where i put { so it looks more "clean" (in my head at least) so this is my code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <iostream>
#include <string>
using namespace std;

class BobbysClass
{
    public:
        void setName(string x)
        {
            name = x;
        }
        string getName()
        {
            return name;
        }
    private:
        string name;

};

int main()
{
    BobbysClass bo;
    bo.setName ("wup wup");
    cout << bo.getName;

    return 0;
}


Thanks for your time :D
I don't see why you'd be getting
no match for 'operator<<

Line 25 has a problem though. You're trying to output a function pointer.
Line 25 should be:
 
 cout << bo.getName() << endl;

Note the () to make that a function call.


Thank you so much <33!!! so stupid.. all i forgot was () -.-'
Topic archived. No new replies allowed.