[ create a new paste ] login | about

Link: http://codepad.org/ERZrmowu    [ 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(){ std::cout << "Im here2" << std::endl; }
    friend void fun3();
};

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

int main() 
{
    void fun2();
    
    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
Im here
Im here3


Create a new paste based on this one


Comments: