1 / 14

OOP Concepts

OOP Concepts. By Rajanikanth B www.btechsmartclass.com. Introduction. OOP stands for O bject O riented P rogramming. Introduction. Majorly there are FOUR concepts in OOPs. Introduction. 1. Encapsulation. 2. Abstraction. 3. Polymorphism. 4. Inheritance.

henriettaa
Télécharger la présentation

OOP Concepts

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. OOP Concepts By Rajanikanth B www.btechsmartclass.com

  2. Introduction OOP stands for Object Oriented Programming

  3. Introduction Majorly there are FOUR concepts in OOPs

  4. Introduction 1. Encapsulation 2. Abstraction 3. Polymorphism 4. Inheritance

  5. BEFORE…start these concepts We must know the following What is an Object? What is a class?

  6. ENCAPSULATION Process of combining data and code Encapsulation = Data + Code Here Data represents Variables in program Here Code represents functions in program

  7. ENCAPSULATION This concept can be implemented using class Encapsulation = Data + Code Class = variables + functions Class is a collection of variables and functions under single unit

  8. ENCAPSULATION BankAccount classBankAccount Attributes • { • String name ; • int accountNumber; • double balance ; • String dateOpened; • String accountType; • String branch; • String name ; • int accountNumber; • double balance ; • String dateOpened; • String accountType; • String branch; Behavior • void open( ){….} • void close( ){….} • void deposit( ){….} • void withdraw( ){….} • void open( ){….} • void close( ){….} • void deposit( ){….} • void withdraw( ){….} • }

  9. ABSTRACTION Process of focusing on the essentials, ignoring the irrelevant and unimportant things Simply abstraction is hiding information which is not required

  10. ABSTRACTION We use access modifiers to implement this concept We use keywords like public, private, protected, friend….

  11. ABSTRACTION private All the members which are declared under private can be accessed by same class members only. No other class can not access the private members of any other class.

  12. ABSTRACTION public All the members which are declared under public, can be accessed by any class members and from any where.

  13. ABSTRACTION protected All the members which are declared under protected, can be accessed by same class members and its derived class members.

  14. ABSTRACTION World Subclass Class Package Modifier Yes Yes Yes Yes public No Yes Yes Yes protected No No Yes No private No No Yes Yes No modifier

More Related