Module 5
Module 5
oriented Programming
using C++
Object-Oriented Programming
• OOP stands for Object-Oriented Programming.
• Procedural programming is about writing procedures
or functions that perform operations on the data, while
object-oriented programming is about creating objects
that contain both data and functions.
Object-oriented programming
Advantages
• OOP is faster and easier to execute
• OOP provides a clear structure for the programs
• OOP helps to keep the C++ code DRY "Don't Repeat
Yourself", and makes the code easier to maintain, modify and
debug
• OOP makes it possible to create full reusable applications
with less code and shorter development time
Classes and Objects
• Classes and objects are the two main aspects of object-
oriented programming.
• a class is a template for objects.
• an object is an instance of a class
Create a Class
Create an
Object
Class Methods
• Public
• members are accessible from outside the class
• Private
• members cannot be accessed (or viewed) from outside the
class
• Protected
• members cannot be accessed from outside the class,
however, they can be accessed in inherited classes.
Encapsulation