Lecture overview -- Keyboard shortcut: 'u'  Previous page: Friends - Class Point - implicit conversion -- Keyboard shortcut: 'p'  Next page: Operator overloading -- Keyboard shortcut: 'n'  Lecture notes - all slides and notes together  slide -- Keyboard shortcut: 't'  Help page about these notes  Alphabetic index  Course home  Lecture 3 - Page 34 : 36
Notes about C++
Abstraction Mechanisms, Part 1
Discussion - Encapsulation, Visibility and Access

Is access control really important in OOP?

Is it really necesary to introduce yet another mechanism, such as friends, to deal with access control?

In C# it is possible to access a private instance variable thorugh a public property of (more or less) the same name. Is this related to our discussion of access control (and to friends)?

  • Minimize the number of methods that relies on the private state of an object

    • Reconsider if protected data members are really needed

    • Reconsider the use of friends

    • Prefer non-member non-friend functions to member functions [Effective C++, Third edition item 23]

Go to exerciseDiscuss encapsulation, visibility and access