i have the following two classes :
class A{
enum ee{a = 1, b = 2 , c = 3};
};
class B{
/*
*/
};
Now i want to use enum ee in class B how i to friend enum ee in class A?\
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
you could restrict access more selectively using this approach:
this introduces restrictions above the other options, for the times you want/need to be more specific wrt access.
specifically,
Adoes not need to be friends withBusing this approach, and the declarations inA::innerare restricted as you have specified.A::innercan then keep its declarations private, and allow access via friendship. clients could declare aninner(accessed viaA::exposed), but it will be of no practical use to the client if the enum type and constants are private.