Skip to main content

Posts

Showing posts with the label code for friend class

declaration of friend classes ,size of heap in c++

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); }