CS304 GDB Solution 2021 Latest
Posted By:
cluesbook
Category: VU GDBs

CS304 GDB Solution 2021 by Cluesbook
Solution#1
In this case, there is a violation of encapsulation because these will be private data classes that can be accessed only through the class interface.
The friendly function will have full access to all the fields of the classes and cannot be hidden in any way since this example uses private user data, it should only be accessed through the class interface.
Solution#2
No, If they’re used properly, they enhance encapsulation.
“Friend” is an explicit mechanism that is used for granting access, just like membership. You cannot a standard-conform

Sharing is Caring
Facebook
Twitter
LinkedIn
Pinterest
Telegram
Telegram
WhatsApp