Oop principles



Download 2,12 Mb.
Sana22.05.2023
Hajmi2,12 Mb.
#942141
Bog'liq
OOP principles

OOP principles

Nabiyev Abdulaziz

Contents

  • What is an Object?
  • What are Classes?
  • What is Inheritance?
  • What is Polymorphism?
  • What is Abstraction?
  • What is Encapsulation?

What is an Object?

  • Let us understand this with an example. Consider your cell phone as an object. There can be different properties for your cell phone like its model, software version, and memory in it. This object can also have functions like switch on the camera, turn off Bluetooth, restart, etc. In simple words, each object contains data and instructions to act on that data.

What are Classes?

  • A class is like a template from which new objects are created.
  • Collection of objects is called class. It is a logical entity.
  • A class can also be defined as a blueprint from which you can create an individual object. Class doesn't consume any space.

What is Inheritance?

  • It is the ability to acquire the properties of existing classes and create new ones. Inheritance allows you to reuse code without having to rewrite it in a program. One of the best features of Inheritance is the ability to shorten the code in a program. You can use this principle to inherit codes from another class and reuse it in a new class.

What is Polymorphism?

  • If one task is performed in different ways, it is known as polymorphism. For example: to convince the customer differently, to draw something, for example, shape, triangle, rectangle, etc.
  • In Java, we use method overloading and method overriding to achieve polymorphism.
  • Another example can be to speak something; for example, a cat speaks meow, dog barks woof, etc.

What is abstraction?

  • Applying abstraction means that each object should only expose a high-level mechanism for using it.
  • This mechanism should hide internal implementation details. It should only reveal operations relevant for the other objects.

What is encapsulation?

  • Encapsulation is achieved when each object keeps its state private, inside a class. Other objects don’t have direct access to this state. Instead, they can only call a list of public functions — called methods.
  • So, the object manages its own state via methods — and no other class can touch it unless explicitly allowed. If you want to communicate with the object, you should use the methods provided. But (by default), you can’t change the state.

Reference

  • https://www.partech.nl/en/publications/2020/10/basic-principles-of-object-oriented-programming#
  • https://medium.com/@cancerian0684/what-are-four-basic-principles-of-object-oriented-programming-645af8b43727
  • https://www.freecodecamp.org/news/object-oriented-programming-concepts-21bb035f7260/
  • https://www.javatpoint.com/java-oops-concepts

Thank you


Download 2,12 Mb.

Do'stlaringiz bilan baham:




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©www.hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish