1 / 608

object oriented programming

Features<br>1.1 Shared with non-OOP predecessor languages<br>1.2 Objects and classes<br>1.3 Class-based vs prototype-based<br>1.4 Dynamic dispatch/message passing<br>1.5 Encapsulation<br>1.6 Composition, inheritance, and delegation<br>1.7 Polymorphism<br>1.8 Open recursion<br><br><br>https://www.timehubzone.com/worldclock/europe

timehubzone
Download Presentation

object oriented programming

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Object Oriented Programming Tutorial Contents Features 1.1 Shared with nonOOP predecessor languages 1.2 Objects and classes 1.3 Class-based vs prototype-based

  2. Object Oriented Programming Tutorial 1.4 Dynamic dispatch/message passing 1.5 Encapsulation 1.6 Composition, inheritance, and delegation 1.7 Polymorphism 1.8 Open recursion

  3. Object Oriented Programming Tutorial Object Oriented Programming Object means a real word entity such as pen, chair, table etc. Object-Oriented Programming is a

  4. Object Oriented Programming Tutorial methodology to design a program using classes and objects. Its main concepts: Object Class Inheritance Polymorphism

  5. Object Oriented Programming Tutorial Abstraction Encapsulation Primitive Primitive data type Int, float , double Boolean, string..... Explicitly

  6. Object Oriented Programming Tutorial Anything create by customize call is explicitly. Change the type of variable customlly is call explicitly. Change the type of variable on runtime is call explicitly.

  7. Object Oriented Programming Tutorial Implicitly Anything create by default call is implicitly. Change the type of variable by customlly Change the type of variable on compile time is call explicitly.

  8. Object Oriented Programming Tutorial Instance Any thing belongs to object is instance An instance is a specific representation of an object, an instance is a single object that has

  9. Object Oriented Programming Tutorial been created in memory. Instances have attribute and behaviors of class Instance: Student s1=new student ("Martin");

  10. Object Oriented Programming Tutorial Student s2=new student ("Kumar"); si and s2 are instances of object student the two are unique. it can be called as reference also.

  11. Object Oriented Programming Tutorial Basically the si and s2 are variables that are assigned an object All the objects are instances. All the instances may not be objects. Instances may be "structure

  12. Object Oriented Programming Tutorial instances" or "objects". worldclock Instance The instance of operator is used to test whether the

  13. Object Oriented Programming Tutorial object is an instance of the specified type (class or subclass or interface). The instance of in java is also known as type comparison

  14. Object Oriented Programming Tutorial operator because it compares the instance with type. It returns either true or false. If we apply the instance of operator with any variable that

  15. Object Oriented Programming Tutorial has null value, it returns false Instantiating any thing point to object is call instantiating B =new class ()// its call instantiating

  16. Object Oriented Programming Tutorial an instance (chair 3) is a single unique, specific representation of an object (a chair). Member Members are just objects or primitive

  17. Object Oriented Programming Tutorial types belonging to a class The following table provides an overview of the kinds of members a class can contain. (Rows for...) Constants

  18. Object Oriented Programming Tutorial Fields Methods Properties Indexers Events Operators Constructors Destructors Types

  19. Object Oriented Programming Tutorial Property A property describes some aspect of the object Properties are a way to expose fields, where fields are the actual variables

  20. Object Oriented Programming Tutorial Class member variables are called "properties Variables in the class is call property Instance variable A variable that is created inside the class but outside the method is

  21. Object Oriented Programming Tutorial known as instance variable. Instance variable doesn't get memory at compile time. It gets memory at runtime when object (instance) is created. That is

  22. Object Oriented Programming Tutorial why, it is known as instance variable. current local time Instance member variable

  23. Object Oriented Programming Tutorial Create a variable without static keyword is call instance member variable Instance member method Create a method without static keyword

  24. Object Oriented Programming Tutorial is call instance member method Static member variable or class member variable Create a variable with static keyword is call class member or static member variable

  25. Object Oriented Programming Tutorial Static member method or class member method Create a method with static keyword is call class member or static member method Object An entity that has state and

  26. Object Oriented Programming Tutorial behavior is known as an object e.g. chair, bike, marker, pen, table, car etc. It can be physical or logical (tangible and intangible). The example of

  27. Object Oriented Programming Tutorial intangible object is banking system. An object has three characteristics: State: represents data (value) of an object.

  28. Object Oriented Programming Tutorial Behavior: represen ts the behavior (functionality) of an object such as deposit, withdraw etc. Identity: Object identity is typically implemented via a

  29. Object Oriented Programming Tutorial unique ID. The value of the ID is not visible to the external user. But, it is used internally by the JVM to identify each object uniquely. For Example: Pen

  30. Object Oriented Programming Tutorial is an object. Its name is Reynolds, color is white etc. known as its state. It is used to write, so writing is its behavior. Object is an instance of a

  31. Object Oriented Programming Tutorial class. Class is a template or blueprint from which objects are created. So object is the instance (result) of a class.

  32. Object Oriented Programming Tutorial Any entity that has state and behavior is known as an object. For example: chair, pen, table, keyboard, bike etc. It can be physical and logical.

  33. Object Oriented Programming Tutorial Object is a thing, but instance is a part of a bundle thing. For example, if Car is a class, then it should contain some of the objects like wheel, steering, door and seat. Now lets come to the point:

  34. Object Oriented Programming Tutorial an object (wheel) is an instance of the Car Memory allocated for the member of class at run time is called object or object is the instance of Class.

  35. Object Oriented Programming Tutorial Object - An instance of a class that has its own state and access to all of the behaviour defined by its class. Object s are instances of class Object is complex data structure

  36. Object Oriented Programming Tutorial Attribute and behaviors Student s1=new student ("Martin"); Student s2=new student("Kumar"); The s1, s2 are having object of class Student

  37. Object Oriented Programming Tutorial time zone Anonymous object Anonymous simply means nameless. An object that has no reference is known as anonymous object.

  38. Object Oriented Programming Tutorial If you have to use an object only once, anonymous object is a good approach. Class A class is a group of objects that has

  39. Object Oriented Programming Tutorial common properties. It is a template or blueprint from which objects are created. A class in java can contain: data member

  40. Object Oriented Programming Tutorial method constructor block class and interface Difference between object and class There are many differences between object

  41. Object Oriented Programming Tutorial and class. A list of differences between object and class are given below: No. Object C 1) Object is C an instance of a a t

  42. Object Oriented Programming Tutorial class. w C 2) Object is a real C world a entity such as s pen, laptop, < mobile, bed, keyboard, mouse, chair etc.

  43. Object Oriented Programming Tutorial 3) Object is C a physical entity. c 4) Object is created C through new c keyword mainly u e.g. k Student s1 = new c Student();

  44. Object Oriented Programming Tutorial 5) Object is C created many c times as per requirement. 6) Object allocates C memory when c it is created. r i

  45. Object Oriented Programming Tutorial 7) There are many T ways to create o object in java t such as new c keyword, new i Instance() k method, clone() method, factory method and

  46. Object Oriented Programming Tutorial deserialization. Aggregation If a class has an entity reference, it is known as Aggregation. Aggregation represents HAS-A relationship.

  47. Object Oriented Programming Tutorial Consider a situation, Employee object contains many information's such as id, name, email ID etc. It contains one more object named address,

  48. Object Oriented Programming Tutorial which contains its own information's such as city, state, country, zip code etc Why use Aggregation? For Code Reusability.

  49. Object Oriented Programming Tutorial When use Aggregation? Code reuse is also best achieved by aggregation when there is no is-a relationship. Inheritance should be used only if the

  50. Object Oriented Programming Tutorial relationship is-a is maintained throughout the lifetime of the objects involved; otherwise, aggregation is the best choice. New keyword

More Related