Object Oriented Language


Published on

Published in: Education, 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
  • Object Oriented Language

    1. 1. Object Oriented Language -A Small discussion
    2. 2. OO Language <ul><li>An object-oriented programming language is one that allows or encourages, to some degree, object-oriented programming techniques such as encapsulation, inheritance, modularity, and polymorphism. </li></ul><ul><li>Simula(1967) </li></ul><ul><li>C++,Smalltalk, Java </li></ul>
    3. 3. C++……… <ul><li>C++ was developed completely in the year 1998. </li></ul><ul><li>C++ is an object oriented version of C </li></ul><ul><li>C++ uses compile-time binding, which means that the programmer must specify the specific class of an object, or at the very least, the most general class that an object can belong to </li></ul>
    4. 4. C++………. <ul><li>Simple program in C++….. </li></ul><ul><li>#include<iostream.h> </li></ul><ul><li>Int main() </li></ul><ul><li>{ </li></ul><ul><li>cout<<“hello world ; </li></ul><ul><li>} </li></ul><ul><li>Bjarne Stroustrup, creator of C++ </li></ul>
    5. 5. Small talk <ul><li>Development started in 1969 and publicly available in 1980 </li></ul><ul><li>Designed by Alan Kay, Dan Ingalls, Adele Goldberg </li></ul><ul><li>Small talk 71,72,76,80 </li></ul><ul><li>Literals, assignments, messages, expressions, code blocks are some terms in small talk. </li></ul>
    6. 6. <ul><li>Transcript show: 'Hello, world!'. </li></ul>
    7. 7. Java <ul><li>Java is the latest, flashiest object-oriented language </li></ul><ul><li>Java is a curious mixture of C++ and Smalltalk </li></ul><ul><li>Java development tools are being rapidly deployed, and are available from such major software companies as IBM, Microsoft, and Symantec. </li></ul><ul><li>  </li></ul>
    8. 8. <ul><li>// HelloWorld.java public class HelloWorld { </li></ul><ul><li>public static </li></ul><ul><li>void main(String[] args) { System.out.println(&quot;Hello, world!&quot;); </li></ul><ul><li>} </li></ul><ul><li>} </li></ul>
    9. 9. Object Oriented Programming Paradigm <ul><li>Data as a critical element in the program. </li></ul><ul><li>Data is not allowed to flow freely around system. </li></ul><ul><li>Ties data more closely to the function that operate on it. </li></ul><ul><li>Protect data from accidental modification by outside functions. </li></ul><ul><li>The group of data and the functions together termed as objects. </li></ul>
    10. 10. The Organization of Data and Functions in OOPs
    11. 11. Features of OOPs <ul><li>Emphasis is on data rather than procedure. </li></ul><ul><li>Programs are divided into what are known as objects. </li></ul><ul><li>Functions that operate on the data of an object are tied together in the data structure. </li></ul><ul><li>Data is hidden and cannot be accessed by external functions. </li></ul><ul><li>Objects may communicate with each other through functions. </li></ul><ul><li>New data and functions can be easily added wherever necessary. </li></ul>
    12. 12. Basic Concepts of OOP <ul><li>1) Objects </li></ul><ul><li>2) Classes </li></ul><ul><li>3) Data abstraction & Encapsulation </li></ul><ul><li>4) Inheritance </li></ul><ul><li>5) Polymorphism </li></ul><ul><li>6) Dynamic binding </li></ul><ul><li>7) Message passing </li></ul>
    13. 13. Objects <ul><li>Objects are the basic run-time entities in an object-oriented system. </li></ul><ul><li>An object is a kind of a self-sufficient “subprogram ” with a specific functional area. </li></ul><ul><li>They may represent a person, a place, a bank account, a table of data or any item that the program has to handle. </li></ul>
    14. 14. Object
    15. 15. Classes <ul><li>The entire set of data and code of an object can be made a user-defined data type with the help of a class. Objects are actually variable of the type class. </li></ul><ul><li>Once a class has been defined, it can be used to create any number of objects belonging to that class. Thus a class is collection of objects of similar type. </li></ul><ul><li>Classes are user defined data types and behaves like the built in type of a programming language. </li></ul><ul><li>A class is a way to bind the data and its associated functions together. </li></ul>
    16. 16. Inheritance <ul><li>Inheritance is the process by which object of one class acquire the properties of objects of another class. </li></ul><ul><li>The concept of inheritance provides the idea of reusability. </li></ul><ul><li>A new class can be derived from the existing one. Then new class will have combined features of both the classes. </li></ul><ul><li>For example an object of the class of car can acquire the properties of the class vehicle. </li></ul>
    17. 17. Types of inheritance <ul><li>Single inheritance </li></ul><ul><li>Multiple inheritance </li></ul><ul><li>Multilevel inheritance </li></ul>
    18. 18. <ul><li>General form </li></ul><ul><li>class class_name </li></ul><ul><li>{ </li></ul><ul><ul><li>private: </li></ul></ul><ul><ul><li>variable declaration </li></ul></ul><ul><ul><li>function declaration </li></ul></ul><ul><ul><li>protected: </li></ul></ul><ul><ul><li>variable declaration </li></ul></ul><ul><ul><li>function declaration </li></ul></ul><ul><ul><li>public: </li></ul></ul><ul><ul><li>variable declaration </li></ul></ul><ul><ul><li>function declaration </li></ul></ul><ul><ul><li>}; </li></ul></ul><ul><li>example </li></ul><ul><li>class student </li></ul><ul><li>{ </li></ul><ul><li>private: </li></ul><ul><li>int roll no,marks,total; </li></ul><ul><li>protected: </li></ul><ul><li>void compute(); </li></ul><ul><li>void display(); </li></ul><ul><li>public: </li></ul><ul><li>student(); </li></ul><ul><li>void execute(); </li></ul><ul><li>}; </li></ul>
    19. 19. Data abstraction <ul><li>Abstraction refers to the act of representing essential features without including the background details or explanations. </li></ul><ul><li>Instruments allowing only selected access of components to objects and to members of other classes is called as data abstraction. </li></ul>
    20. 20. Encapsulation <ul><li>The binding of data and function together into a single entity is called encapsulation. </li></ul>
    21. 21. Polymorphism <ul><li>Polymorphism is the ability to take more than one form. </li></ul><ul><li>With polymorphism an operation may show different behavior in different instances. The behavior depends upon the type of data used in the operation. </li></ul><ul><li>Eg: Operation of addition for two numbers, will generate a sum. If the operands are strings, then the operation would produce a third string by concatenation. </li></ul><ul><li>The process of making an operator to show different behavior in different instance is called as operator overloading. OOPL support operator overloading </li></ul>
    22. 22. Polymorphism (contd.) <ul><li>Function overloading means using a single function name to perform different types of tasks. </li></ul>
    23. 23. Structure Of C++ <ul><li>The general form of C++ program is: </li></ul>
    24. 24. <ul><li>// program to add two numbers using class </li></ul><ul><li>#include<iostream.h> </li></ul><ul><li>#include<conio.h> </li></ul><ul><li>class add </li></ul><ul><li>{ </li></ul><ul><li>private: </li></ul><ul><li>int a,b; </li></ul><ul><li>public: </li></ul><ul><li>int sum; </li></ul><ul><li>void getdata() </li></ul><ul><li>{ </li></ul><ul><li>a=5; </li></ul><ul><li>b=10; </li></ul><ul><li>sum=a+b; </li></ul><ul><li>} </li></ul><ul><li>}; </li></ul><ul><li>void main() </li></ul><ul><li>{ </li></ul><ul><li>add s; </li></ul><ul><li>s.getdata(); </li></ul><ul><li>cout<<s.sum; </li></ul><ul><li>} </li></ul>
    25. 25. Thank You