Oops And C++ Fundamentals


Published on

History of C++ andbasic concepts of object oriented programming.

Published in: Education
  • Be the first to comment

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

No notes for slide

Oops And C++ Fundamentals

  1. 1. Click to go my blog – http://excellentprogramming.blogspot.com
  2. 2. History of c++ <ul><li>Created by Bjarne stroustrup. </li></ul><ul><li>The C language is still supported with C++. </li></ul><ul><li>BCPL language contributed many ideas. </li></ul><ul><li>Class and oop comes from Simula67. </li></ul><ul><li>Originally known as c with class. </li></ul><ul><li>C++ named by Rick Mascitti in 1983. </li></ul>
  3. 3. Continue .... <ul><li>Still low level enough to be efficient. </li></ul><ul><li>Still high level enough to be easy to code in. </li></ul><ul><li>Makes heavy use of additional libraries. </li></ul><ul><li>Comes with intrinsic math function etc. </li></ul><ul><li>Able to coexit with other language. </li></ul>
  4. 4. Continue .... <ul><li>Will not help a bad programmer to be good one. </li></ul><ul><li>Oop will assist in the design of the program. </li></ul><ul><li>C is not necessary to know before C++. If you know c , it’s good. But i am not recommmedning you to use some bad procedurial way of programming. So better stay away from those and make you life more easier with C++. </li></ul>
  5. 5. Most used shortcut keys in TC <ul><li>As a good programmer you must use the short cut keys. </li></ul><ul><ul><li>Save – F2 </li></ul></ul><ul><ul><li>Compile – F9 </li></ul></ul><ul><ul><li>Make – Alt+F9 </li></ul></ul><ul><ul><li>Run – Ctrl+F9 </li></ul></ul>
  6. 6. Your first programme <ul><li>Header file – the function description and it’s action code in those file. </li></ul><ul><li>Main function – Your programe execution strats from here. </li></ul><ul><li>Hence all code must be inside of main function </li></ul><ul><li>Cout is used to display something on screen. </li></ul>#include<stdio.h> #include<iostream.h> int main() { cout<<&quot;Hi! Welcome to OOP's world&quot;; return 0; }
  7. 7. What Is Object-Oriented Programming? <ul><li>In structured programming techniques programs are typically organized around code. </li></ul><ul><li>In Object-oriented programming techniques programs are organized around data, with the key principle being &quot;data controlling access to code.&quot; In an object-oriented language, you define the data and the routines that are permitted to act on that data. </li></ul><ul><li>We must define precisely the data type what sort of operations can be applied to that data. </li></ul>
  8. 8. Three traits of OOP <ul><li>According to the principles of object-oriented programming, all OOP languages have three traits in common: </li></ul><ul><ul><li>Encapsulation </li></ul></ul><ul><ul><li>Polymorphism </li></ul></ul><ul><ul><li>inheritance </li></ul></ul>
  9. 9. Encapsulation <ul><li>Encapsulation is the mechanism that binds together code and the data it manipulates. </li></ul><ul><li>It keeps both safe from outside interference and misuse. </li></ul><ul><li>In object – oriented language code and data may be combined in such a way that a self-contained &quot;black box&quot; is created. </li></ul>
  10. 10. Continue .... <ul><li>code and data are linked together in this fashion, an object is created. We can say this as an object is the device that supports encapsulation. </li></ul><ul><li>Within an object, code, data, or both may be private to that object or public. </li></ul><ul><li>An object is a variable of a user-defined type. We can use it as like variable. However, in object-oriented programming, Each time you define a new type of object, you are creating a new data type. Each specific instance of this data type is a compound variable. </li></ul>
  11. 11. Private and public
  12. 12. Polymorphism <ul><li>Polymorphism is characterized by the phrase &quot;one interface, multiple methods”. </li></ul><ul><li>polymorphism is the attribute that allows one interface to control access to a general class of actions . </li></ul><ul><li>The specific action selected is determined by the exact nature of the situation . </li></ul>
  13. 13. Continue .... <ul><li>It helps reduce complexity by allowing the same interface to be used to access a general class of actions. </li></ul><ul><li>It is not our job to select the specific action as it applies to each situation. It is the job of our compiler(which compiles your program writeen in high level language). </li></ul><ul><li>C++, both run-time and compile-time polymorphism are supported. </li></ul>
  14. 14. Inheritance <ul><li>Inheritance is the process by which one object can acquire the properties of another object like son has some father’s characters. </li></ul><ul><li>This is important because it supports the concept of classification. </li></ul><ul><li>Without inheritance we have to define properties or behaviour explicitly for each and every class even those are related to some one . </li></ul>
  15. 15. Continue .... Example of inheritance
  16. 16. Continue .... <ul><li>However, through the use of classifications, an object need only define those qualities that make it unique within its class. It is the inheritance mechanism that makes it possible for one object to be a specific instance of a more general case. </li></ul><ul><li>Go to my blog to download the program excellentprogramming </li></ul>