[ create a new paste ] login | about

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

C++, pasted on Oct 16:
#include <iostream>

class A{

public:
    friend void fun(A a){std::cout << "Im here" << std::endl;}
    friend void fun2();
    friend void fun3();
};

void fun3(){
    std::cout << "Im here3" << std::endl;
}

int main() 
{
    void fun2(){ std::cout << "Im here2" << std::endl; }
    
    fun(A()); // works ok
    //fun2(); error: 'fun2' was not declared in this scope
    //A::fun2(); error: 'fun2' is not a member of 'A'
    fun3(); // works ok
}


Output:
1
2
3
In function 'int main()':
Line 17: error: a function-definition is not allowed here before '{' token
compilation terminated due to -Wfatal-errors.


Create a new paste based on this one


Comments: