Logo

dev-resources.site

for different kinds of informations.

Day 18 - Object Oriented Programming

Published at
12/6/2024
Categories
python
payilagam
object
class
Author
lakshmipritha
Categories
4 categories in total
python
open
payilagam
open
object
open
class
open
Author
13 person written this
lakshmipritha
open
Day 18 - Object Oriented Programming

Object Oriented Programming(OOPS):

OOPS stands for Object-Oriented Programming System, which is a programming paradigm based on the concept of objects.

Class:

A blueprint or template for creating objects.
Class represent logical entities.

Object:

An object is representation of a class.
Objects represent real-world entities or real time entities.
Objects has states and behavior.

we cannot create object without class.But class can be present without objects.

Example with Bike:

The Bike class defines what a bike is and what it can do.
States like brand, color, and speed describe the bike.
Behavior like start, accelerate, and stop define actions a bike can perform.
Activa and Scooter are objects of the Bike class.
Each object represents a real bike with specific states (e.g., brand and color) and behaviors.

Example:

import calculator
#Object Creation
calc=calculator()
Enter fullscreen mode Exit fullscreen mode

Here calculator is a class and calc is a object.

Encapsulation:

Encapsulation is the bundling of data (attributes) and methods that operate on the data within one unit (class). It also restricts direct access to some components of the object.

Public, Protected, and Private Attributes:

Public:Accessible everywhere (self.name).

Protected:Accessible in the class and subclasses (self._name).

Private: Accessible only within the class (self.__name).

Example:

class company:
    def __research():
        pass
    def __give_salary():
        pass

co=company()
co.__research()

Enter fullscreen mode Exit fullscreen mode

__ is the special symbol called docker.

Python is multi paradigm Programming language.
Python supports
1.Object Oriented Programming
2.Functional programming
3.Modular Programming
4.Procedure oriented Programming

C# supports object oriented programming.
Java and JS supports object oriented programming and functional programming.

Interpreter, compiler and OS written by C language. That supports procedure oriented programming.

We can install the module using the following commend:

sudo apt install python3-modulename

Example for emoji module:

import emoji
result = emoji.emojize('Python is :thumbs_up:')
print(result)

# You can also reverse this:
result = emoji.demojize('Python is πŸ‘')
print(result)

Enter fullscreen mode Exit fullscreen mode
Python is πŸ‘
Python is :thumbs_up:
Enter fullscreen mode Exit fullscreen mode
class Article's
30 articles in total
Favicon
Day3 Class and object in java:
Favicon
Day2 java program
Favicon
Day 6 - Object & Class
Favicon
Unflatten in PyTorch
Favicon
Day 4 java class
Favicon
Get 10th Class Math Notes (Matric Part 2) – Download Now for Free
Favicon
Day 18 - Object Oriented Programming
Favicon
Flatten in PyTorch
Favicon
Elevate Learning with Our E-Class: The Ultimate Student Performance Tracking Software
Favicon
Elevate Learning with Class Connect Pro: The Ultimate Student Performance Tracking Software
Favicon
ExtendableError usage in changesets errors package
Favicon
WordPress Training In Hyderabad
Favicon
Understanding the Distinction Between Class and Object in Object-Oriented Programming
Favicon
OOP concepts are importants
Favicon
Class : Inheritanceβœ… | Struct : Inheritance ❌
Favicon
One JS Class to speak them all
Favicon
Classes in C# | Uzbek
Favicon
Javascript classes explanation in a simple way
Favicon
Unveiling the Power of the :empty() CSS Pseudo-Class
Favicon
Mastering the :not() CSS Pseudo-Class
Favicon
Exploring the :has() CSS Pseudo-Class
Favicon
Unveiling the Java Superhero: The Mysterious Object Class
Favicon
How to use functions in react class components?
Favicon
Safeguarding the Seas: The Strategic Importance of Virginia-Class Submarines
Favicon
Mastering Metaclasses in Python using real-life scenarios
Favicon
TypeScript: Namespace VS Class
Favicon
Understanding Object-Oriented Programming: Unveiling the Power of Classes
Favicon
Learning Python classes
Favicon
Java Polymorphism Best Practices: Writing Clean and Extensible Code
Favicon
This Is How I Prepare The Very Best Regularization / Classification Images Dataset For Stable Diffusion

Featured ones: