Back to Browse

Encapsulation - Object Oriented Programming in C++ (Part 2)

39.5K views
May 17, 2012
10:30

Part 2 in a series about object oriented programming (OOP) in C++. This video covers the basic information regarding encapsulation and methods. Questions and constructive feedback are always welcome! From http://codemium.wordpress.com/object-oriented-programming-in-c/. A good example of real-world encapsulation is an elevator. An elevator's hoisting mechanism could be implemented in many different ways: it could be a traction mechanism, a rope mechanism, a hydraulic mechanism, or some other completely different mechanism. However, when you use an elevator, its implementation doesn't matter to you; all you need to know is that if you press a button, it will eventually take you to your desired floor. In fact, the elevator's implementation may be replaced with a different one, and you may never know the difference, as an elevator user. The same idea can be applied to programming. The better you encapsulate objects, the easier it is to separate their use from their implementation. If at some point, you decide to change how your object is implemented, you may do so without affecting the rest of your code. In addition, you protect your code from unwanted changes... I wouldn't want anyone tampering with the brakes of my elevator! It's a good thing they're safely hidden from public access. Twitter: https://twitter.com/swiftflux Do you like video games? Check out this awesome streamer: Twitch: http://www.twitch.tv/not_jenn Twitter: https://twitter.com/not__jenn

Download

0 formats

No download links available.

Encapsulation - Object Oriented Programming in C++ (Part 2) | NatokHD