The document discusses object-oriented programming (OOP) concepts including encapsulation, abstraction, inheritance, polymorphism, and classes. It explains that OOP is a programming paradigm that uses objects which contain both data and code. Classes define the data and behavior of objects, and can be reused, extended, and abstracted to simplify programming and code maintenance. Inheritance allows new classes to inherit attributes and behaviors from existing classes. Polymorphism enables the same function to operate in different ways depending on the object it is acting upon.
Introduces Object Oriented Programming (OOP) as a coding paradigm compared to procedural programming.
Contrasts procedural programming with OOP, highlighting OOP concepts like encapsulation and abstract data types.
Encapsulation in OOP: simplifies usage of classes. Emphasis on data hiding and more abstraction.
Describes code reusability, faster development, higher quality, and importance in software engineering.
Focuses on inheritance allowing new classes from existing ones, enhancing reusability.
Explains class structure, attributes, actions, and class as a blueprint for object creation.
Details class interface, access modifiers (public, private, protected) and their impacts on accessibility.Defines getters and setters, their roles in data protection, and their alternative names as accessors and mutators.
Defines abstract classes with pure virtual functions, creating reusable and extensible code structures.
Reiterates concepts of inheritance in object-oriented programming.
Explains polymorphism, identifying compile-time and runtime types, including function overloading and overriding.
Acknowledges sources and credits for the presentation materials used.
- Procedural Programming -Focus on processes or actions that a program takes - Programs are typically a collection of functions - Data is declared separately - Data is passed as arguments into functions As Programs get larger they become more: Difficult to understand Difficult to maintain Difficult to extend Difficult to debug Difficult to code
4.
Object Oriented Programming Object-oriented programming(OOP) is a programming paradigm based on the concept of "objects", which can contain data and code: data in the form of fields (often known as attributes or properties), and code, in the form of procedures (often known as methods). - Encapsulation - Objects contain data and operations that work on that data - Abstract Data Type ( ADT)
Object Oriented Programming - Information- Hiding - Encapsulation - Implementation - specific logic be hidden - User of class code to be interface since they don’t need to know the implementation - More abstraction - Easier to test, debug, maintain and extend
09:Object Oriented Programmingprovide code reuse Code reuse is the practice of using existing code for a new function or software. This saves time, improves the features in your program, and generally makes for more cost-effective programming. Reusability is an important issue in software engineering.
09:Object Oriented Programming Aclass is an extensible program-code-template for creating objects, although a very tiny application might need just a single class. The class must go within a pair of curly braces.
09:Object Oriented Programmingprovide code reuse Code reuse is the practice of using existing code for a new function or software. This saves time, improves the features in your program, and generally makes for more cost-effective programming. Reusability is an important issue in software engineering.
Accessing Class Wecan access - Class attributes - Class methods Some class members will not be accessible (more on that later) We need an object to access instance variables
27.
Class Access Modifier -public , private and protected - public - Accessible everywhere - private - Accessible only by members or friends of the class - protected - Used with inheritance - we’ll talk about it in the next section
28.
Class Access Modifier -public , private and protected - public - Accessible everywhere - private - Accessible only by members or friends of the class - protected - Used with inheritance - we’ll talk about it in the next section
29.
Class Access Modifier -public , private and protected - public - Accessible everywhere - private - Accessible only by members or friends of the class - protected - Used with inheritance - we’ll talk about it in the next section
30.
Class Access Modifier -public , private and protected - public - Accessible everywhere - private - Accessible only by members or friends of the class - protected - Used with inheritance - we’ll talk about it in the next section
31.
Class Access Modifier -public , private and protected - public - Accessible everywhere - private - Accessible only by members or friends of the class - protected - Used with inheritance - we’ll talk about it in the next section
32.
Class Access Modifier -public , private and protected - public - Accessible everywhere - private - Accessible only by members or friends of the class - protected - Used with inheritance - we’ll talk about it in the next section
33.
Class Access Modifier -public , private and protected - public - Accessible everywhere - private - Accessible only by members or friends of the class - protected - Used with inheritance - we’ll talk about it in the next section
34.
What are settersand getters? Getters and setters are used to protect your data, particularly when creating classes. For each instance variable, a getter method returns its value while a setter method sets or updates its value. Given this, getters and setters are also known as accessors and mutators, respectively.
35.
What are settersand getters? Getters and setters are used to protect your data, particularly when creating classes. For each instance variable, a getter method returns its value while a setter method sets or updates its value. Given this, getters and setters are also known as accessors and mutators, respectively.
36.
What is aabstract? By definition, an abstract class in C++ is a class that has at least one pure virtual function (i.e., a function that has no definition).
37.
What is aC++ abstract class? By definition, an abstract class in C++ is a class that has at least one pure virtual function (i.e., a function that has no definition).
38.
What is aC++ abstract class? Abstract classes are essential to providing an abstraction to the code to make it reusable and extendable. For example, a Vehicle parent class with Truck and Motorbike inheriting from it is an abstraction that easily allows more vehicles to be added. However, even though all vehicles have wheels, not all vehicles have the same number of wheels – this is where a pure virtual function is needed.
What is Polymorphismin C++? Polymorphism in C++ means, the same entity (function or object) behaves differently in different scenarios
43.
What is Polymorphismin C++? 2. Runtime Polymorphism In a Runtime polymorphism, functions are called at the time the program execution. Hence, it is known as late binding or dynamic binding. Function overriding In function overriding, we give the new definition to base class function in the derived class. At that time, we can say the base function has been overridden. It can be only possible in the ‘derived class’. In function overriding, we have two definitions of the same function, one in the superclass and one in the derived class. The decision about which function definition requires calling happens at runtime. That is the reason we call it ‘Runtime polymorphism’.
44.
What is Polymorphismin C++? 1. Compile Time Polymorphism In compile-time polymorphism, a function is called at the time of program compilation. We call this type of polymorphism as early binding or Static binding. Function overloading and operator overloading is the type of Compile time polymorphism. Function Overloading Function overloading means one function can perform many tasks. In C++, a single function is used to perform many tasks with the same name and different types of arguments. In the function overloading function will call at the time of program compilation. It is an example of compile-time polymorphism.
45.
CREDITS: This presentationtemplate was created by Slidesgo, including icons by Flaticon, and infographics & images by Freepik Thanks