MISRA Discussion Forums
Can I get by with a little help from My Friends? - Printable Version

+- MISRA Discussion Forums (https://forum.misra.org.uk)
+-- Forum: MISRA C++ (https://forum.misra.org.uk/forumdisplay.php?fid=18)
+--- Forum: MISRA C++:2008 rules (https://forum.misra.org.uk/forumdisplay.php?fid=19)
+---- Forum: 6.11 Member access control (C++) (https://forum.misra.org.uk/forumdisplay.php?fid=140)
+---- Thread: Can I get by with a little help from My Friends? (/showthread.php?tid=582)



Can I get by with a little help from My Friends? - gs - 12-09-2008

Rule 11-0-1 states,
Quote:Member data in non-POD class types shall be private.
with the rationale:
Quote:By implementing class interfaces with member functions, the implementation retains more control over how the object state can be modified, and helps to allow a class to be maintained without affecting clients.
Does the above mean non-POD structure types should not contain any friend declarations? A friend declaration would by definition allow for the circumvention of the access restrictions.


Re: Can I get by with a little help from My Friends? - misra cpp - 07-10-2015

There are no restrictions on the use of “friend” access within POD or non-POD structures.