Posts

Showing posts with the label friend class and function in cpp.friend class in oops

Friend Class In C++ | Friends Class Explained By Real Life Example

 Friend Class In C++  What is a friend class? A friend class is that class that is a friend of any class. BRUH... I mean that as you have a friend which has access to your every private + protected information like what you like in food, who is your gf 😍😂, what is your weakness but only when you declared it as a friend. So as similar to in real life, you can create friends on programming too.  Okay now here is the official definition of friend class -  A  friend class  is a  class  that can access the private and protected members of a  class  in which it is declared as a  friend . This is needed when we want to allow a particular  class  to access the private and protected members of a  class . So here I explained how a friend class explained by a real-life example -  #include   < iostream > using   namespace   std ; //Here is a class of you where yo...