Introduction to OOP Chapter 23: Object Interconnections : next previous audio real text

Internal Data Coupling


class  SneekyModifier {
public:
  void sneeky () {
    // change my friends name		
    myFriend->name = "Lucy";
  }
  Person * myFriend;
};


class Person {
public:
  Person () { 
    name = "Larry";
  }
  string name;
};  

This is bad because it makes it difficult to understand a single class in isolation.

Can be mitigated by always making your data areas private or protected, and not exposing pointers to these areas.

Intro OOP, Chapter 23, Slide 07