Declaration of friend classes
class XYZ
{
int x;
public:
};
class ABC
{
int y;
public:
friend class XYZ;
};
/////////////
class ABC; //forward declaration
class XYZ
{
int x;
public:
void fun(){
... ABC tmp;
... tmp.y=10; //legal
}
};
class ABC
{
int y;
public:
friend class XYZ;
void fun()
{
... XYZ tmp;
... //tmp.y=10; Illegal
}
};
//Size of heap in c++
#include
#include
int main()
{
char *a=(char *)0;
int (*fun)()=main;
printf("%u ",fun);
return(0);
}