C plusplus


Published on

Published in: Technology
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

C plusplus

  1. 1. OOPs in C++ Presented By: Ms. Niti Gupta
  2. 2. Main Areas <ul><li>Procedure Oriented Programming Language </li></ul><ul><li>Object Oriented Programming Language </li></ul><ul><li>Concepts of OOPs </li></ul>
  3. 3. Procedural Oriented Programming Language <ul><li>The main program coordinates calls to procedures and hands over appropriate data as parameters. </li></ul>
  4. 4. Features of Procedure Oriented Programming Language <ul><li>Emphasis is on doing things. </li></ul><ul><li>Larger programs are divided in to smaller programs known as functions. </li></ul><ul><li>Data is Global shared by almost all the functions. </li></ul><ul><li>Employs Top Down approach in Program Design. </li></ul>
  5. 5. Examples of Procedure Oriented Programming Language <ul><li>COBOL </li></ul><ul><li>FORTRAN </li></ul><ul><li>C </li></ul>
  6. 6. Object-Oriented Concept <ul><li>Objects of the program interact by sending messages to each other </li></ul>
  7. 7. Features of OOPs <ul><li>Emphasis is on data rather than procedures. </li></ul><ul><li>Programs are divided into objects which are very close to the real world. </li></ul><ul><li>Data is hidden and cannot be accessed by external functions. </li></ul><ul><li>Functions that operate on the data are tied together into an object. </li></ul><ul><li>Follows Bottom up approach in program design. </li></ul>
  8. 8. Basic Concept of Object-Oriented <ul><li>Objects </li></ul><ul><li>Classes </li></ul><ul><li>Data Abstraction </li></ul><ul><li>Data Encapsulation </li></ul><ul><li>Inheritance </li></ul><ul><li>Polymorphism </li></ul><ul><li>Dynamic Binding </li></ul>
  9. 9. Objects <ul><li>Run time entities that may represent a person, place, bank account or any item. </li></ul><ul><li>Each object contains data, and code to manipulate the data. </li></ul><ul><li>Data represents the attributes of that object and functions represents the behaviour of that object </li></ul>
  10. 10. Objects Contd.
  11. 11. Classes <ul><li>User defined data types on which objects are created. </li></ul><ul><li>Objects with similar properties and methods are grouped together to form a Class. </li></ul><ul><li>For example, mango, apple and orange are members of class fruit. </li></ul>
  12. 12. Data Abstraction <ul><li>Abstraction refers to the act of representing essential features without including the background details or explanations. </li></ul>
  13. 13. Data Encapsulation <ul><li>Wrapping of data and functions into a single unit is known as data encapsulation. </li></ul><ul><li>Data is not accessible to the outside world, only those functions which are wrapped in the class can access it. </li></ul>
  14. 14. Inheritance <ul><li>Process of deriving a new class from an existing one is called Inheritance. </li></ul><ul><li>The existing class is known as base class, parent class or super class. </li></ul><ul><li>The new class that is formed is called derived class, child class or sub class. </li></ul><ul><li>Derived class has all the features of the base class plus it has some extra features also. </li></ul>
  15. 15. Example of Inheritance Automobile Two Wheeler Three Wheeler Four Wheeler Scooter Motor Bike Auto Rickshaw Car Bus
  16. 16. Types of Inheritance <ul><li>Single level </li></ul><ul><li>Multi level </li></ul><ul><li>Multiple </li></ul><ul><li>Hierarchical </li></ul><ul><li>Hybrid </li></ul>
  17. 17. Single Level Inheritance When there is one base class and only one class is deriving from it. Base Class Derived Class
  18. 18. Multi Level Level Inheritance Class A Class B A class is derived from an already derived class. Class A is a base class for the derived class B. Class B is a base class for the derived class C. So, Class B is known as intermediate base class. Class C
  19. 19. Multiple Inheritance Class A Class B A Derived Class is created from two or more base classes. Class C
  20. 20. Hierarchical Inheritance Two or more classes are derived from one base class. Class A Class B Class C Class D Class E
  21. 21. Hybrid Inheritance Class A Class B Class C Class D Class E Combination of two or more types of Inheritance.
  22. 22. Polymorphism <ul><li>Ability to take more than one form. </li></ul><ul><li>It includes </li></ul><ul><li>Function Overloading </li></ul><ul><li>Operator Overloading </li></ul>
  23. 23. Function Overloading <ul><li>Function Overloading refers to use of same function name for different purposes. These functions differ from each other by no. and types of arguments. </li></ul>Draw() Draw() Draw() Draw()
  24. 24. Operator Overloading <ul><li>Operator Overloading is a mechanism of redefining the meaning of C++ operators. </li></ul><ul><li>For example: +, - ,++, -- ,* etc. </li></ul>
  25. 25. Binding <ul><li>Binding means connecting the function call to the code to be executed in response to the call. </li></ul>Binding Static Dynamic
  26. 26. Static Binding <ul><li>Static Binding means that the code associated with the function call is linked at compile time. </li></ul><ul><li>Also known as early Binding or compile time Polymorphism. </li></ul>
  27. 27. Dynamic Binding <ul><li>Dynamic Binding means that the code associated with the function call is linked at run time. </li></ul><ul><li>Also known as late Binding or run time polymorphism. </li></ul>
  28. 28. Advantages of OOPs <ul><li>Data Security. </li></ul><ul><li>Reusability of existing code. </li></ul><ul><li>Creating new data types. </li></ul><ul><li>Abstraction. </li></ul><ul><li>Less development time. </li></ul><ul><li>Reduce Complexity. </li></ul><ul><li>Better Productivity. </li></ul>
  29. 29. <ul><li>Thanks </li></ul>
  30. 30. <ul><li>Queries Please </li></ul>