dimanche 10 novembre 2019

How to check if a variable is private

This seems to be duplicate but I didn't find the answer...

My class requires me to write a method that produces a message of "error" when trying to access a private variable from a class. I tried many different ways, including the simplest way "cout << a", but my compiler refuses to compile when 'a' is a private variable. Is there a way to check it?

The description of the task is like this:

Write a program that, when compiled, generates this error message: error: '???' is a private member of 'BigInt' (The ??? will depend on your implementation.) Then, change the data member visibility to public and make this error message go away,

Aucun commentaire:

Enregistrer un commentaire