The output includes some numbers which shouldn't appear

#include<iostream>
using namespace std;

class alpha
{int data;
public:
alpha():data(3){}
friend int frifunction(alpha);};

int frifunction(alpha a)
{if(a.data==3)
{cout<<"This function has access to the Private and Protected members of alpha";}}

int main()
{
alpha a;
cout<<frifunction(a)<<endl;

system("pause");
return 0;

}

Just wanted to try friend Functions , as I find it most easily to learn new things by trying to modify other programs, this one is similar(but modified) to the one in cplusplus.com , but in this one i keep getting an output after the statement "this function has acces......" i get 4469696

was wondering why does it appear? and would really enjoy knowing it :D

Well, you aren't returning anything in frifunction, so the return value remains uninitialized.
What did you expect?
ah lol yeah , int ty mate , I expected 'This function has access to the Private and Protected members of alpha' to be the output without the numbers ;)
Last edited on
Topic archived. No new replies allowed.