[ create a new paste ] login | about

Link: http://codepad.org/BBNKtaE9    [ raw code | output | fork ]

C++, pasted on Jul 26:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include <iostream>

class Bacon {
    int chunky;
public:
    Bacon() : chunky(42) {}
    friend int getChunky(Bacon const& b) { return b.chunky; }
};

int main()
{
    Bacon b;
    std::cout << getChunky(b);
    std::cout << b.getChunky(b);
}


Output:
1
2
3
In function 'int main()':
Line 14: error: 'class Bacon' has no member named 'getChunky'
compilation terminated due to -Wfatal-errors.


Create a new paste based on this one


Comments: