Download presentation
Presentation is loading. Please wait.
1
Object-oriented programming principles
A Lecture for the c++ Course Each slide has its own narration in an audio file. For the explanation of any slide, click on the audio icon to start the narration. The Professor‘s C++Course by Linda W. Friedman is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.
2
Oop principles Inheritance, encapsulation, and polymorphism are the basic principles of object-oriented programming. OOP Principles
3
Inheritance Inheritance is the guiding principle for the relationship between classes. This is an explicit is-a relationship. Examples: Zebra is-a mammal Flower is-a plant Subclass superclass The more specialized class inherits attributes and behaviors from the more generalized class. OOP Principles
4
Encapsulation Encapsulation means that a class is cohesive and self-contained. The purpose of encapsulation is information hiding. If a class is designed well, its definition (implementation) can easily be hidden from other programmers who use the class in their programs; they only need to see the class interface in order to use the class. OOP Principles
5
Polymorphism Polymorphism - poly (many) morph (form) - if two (or more) objects have the same interface (what the user of the class sees), but exhibit different behaviors, they are said to be polymorphic. Similar to function / operator overloading. OOP Principles
6
What vs. how Just like we learned when programming with functions, with classes we also distinguish between the interface and the implementation. Interface - the visible functionality of a class -- the "what" Implementation - the internal functionality and attributes of a class. A class's implementation is hidden from users of the class. -- the "how" OOP Principles
7
Review What did we learn in this lecture? Plenty. Some terms to jog your memory: base class polymorphism class class attributes class implementation class interface encapsulation information hiding inheritance object OOP Principles
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.