Computer Science, asked by babaplays18, 2 months ago

friend function can be overloaded or not?​

Answers

Answered by ishita1chopra
1

Answer:

yeah, you can overload a friend function just like any normal function.

Explanation:

#include <iostream>

class EXAMPLE

{

public:

friend void fn ( );

friend void fn ( int a);

};

void fn()

{

std::cout << "First one" << std::endl;

}

void fn( int a)

{

std::cout << "Second one" << std::endl;

}

int main()

{

fn();

fn( 13);

return 0;

}

Similar questions