Coder Social home page Coder Social logo

jar-class's Introduction

Jar-Class

Explains Class and Methods of OOP(Python)

Working of Class in Python

Object Oreinted Program

So, first thing might be what is object oriented program ??

In real world everything around us are object like TV,Laptop,Pencil,Headphone. Similarly in OOP(Object Oriented Programming) image,audio,video or anything can be considered as object.

So, what's it's use in languages like python ?? If you have ever coded in C you first have to declare what type of variable you are using.

like In C : int i; i = 1;

In this above small program you have to declare what type of identifier you are using and If you see clearly you are getting restricted in this case suppose you have to store and image in the variable then how can you do it in C ?? (You can do it but it is a little complex)

But in Python it is easier to assign any value or any image or any video to any variable (In this variable acts like container which can store anything) without even declaring its type.

Like In Python: i = 1; i = ๐Ÿช; or i = "๐Ÿช";

But this is just the tip of OOP the main benefit of OOP is linked with its Class and Methods:

Class and Methods

But what is Class and Method in python ??

First lets understand what is method in python . Let me give you an example : In Python: l1 = [] l1.append() l1.pop()

l1 is a list type and you can use append() and pop() functions with the variable itself. This append() and pop() are methods of list. Methods are nothing but functions defined inside class.

Then what is class??? Suppose you are a student of KV Thane and you have your ROll number but there are many other students like you so to make it easy we make a class of KV Thane students.

But you might say what is its profit you can even make a csv file or dictionary or list for it. But wait what i said about methods. In Class you can also define your own functions and use them with your variables and like append() of list you can use your own functions with the class.

SO, Methods are nothing but just functions which are defined in class and can only be accessed by that class.

I would suggest you to make a python program with class and methods and instances in it from scratch so you will be able to get the better understanding of it.

Thank YOu

Also There might be mistakes in my explanation . I would encourage suggestions and corrections.!

jar-class's People

Contributors

space-techy avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.