#include<iostream>
using namespace std;
class base
{
private:
int id = 6;
public:
friend void display();
};
void display()
{
base b;
cout<<"Display id" <<b.id<<endl;
cout<<"Display id", b.id;
}
int main()
{
display();
}
Output:
Display id6
Display id
Can someone explain that why cout<<"Display id", b.id;
is not throwing error? and if comma (,) is acceptable then what will be the behavior of variables written after comma (,).
Thanks in advance.