Answer to Question #163852 in C++ for Task

Question #163852

ATM (Automated Teller Machine) machines are electronic outlets that allow customers to do their basic transactions without interaction of bank’s representative. While programming this ATM in C++, We have created a class named CUSTOMER which stores customer data (i.e. name, NIC, age, address, account balance and transaction history etc.). There is a friend function that wants to access some private information of the class.

GDB Question: 

Being a C++ developer, analyze the whole scenario, what do you think “Does a friend function contradict the rules of Encapsulation?”



1
Expert's answer
2021-02-15T02:41:36-0500

I accept that for this situation there is an infringement of epitome. Since these will be private information classes that can be gotten to just through the class interface. The cordial capacity will have full admittance to all the fields of the class and can't be covered up in any capacity. Since this model uses private client information, it should just be gotten to through the class interface.

Indeed. 


Embodiment is an OOP idea that ties information and strategies that control the information together and keep both the techniques and information from impedance or alteration from outside. At the end of the day, exemplification advances information stowing away. A companion work nonetheless, is characterized outside the particular epitomized information scope, for this situation CUSTOMER class. A companion work that gets to the information disregards exemplification as it gets to the information inside CUSTOMER class while it isn't characterized inside the CUSTOMER class scope


Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment