SIZ-Tutorial || Object Oriented Programing Python || 20% Pay out to @siz-official || By @hamzajameel || #CLUB5050

in hive-181430 •  3 years ago 

Assalam o Alaiakum!

How are you all. I hope all well as well. I am also fine Alhamdulillah.

20% Pay Out To @siz-official:

Python Object Oriented:

image.png
Source

Python has been an object-oriented language ever since it became popular. This makes it very easy to create and use classes and items. If you have no personal experience in Object Oriented Programming, you may want to consult an introductory course or at least a tutorial on the minimum grasp of the basic components.

Overview of OOP Terminology:

Class:

USR-defined prototype for an object that describes a set of attributes that highlight any component of the class. Attributes are data members and methods, which are obtained through dot notation.

Class Variable:

A variable that is shared by all the examples in the class. Class variables are defined within the class but outside of the class in any way. Class variables are not used as often as the example variables.

Data Member:

A class variable or instance variable that contains data associated with a class or its injector.

Function Overloading;

Multiple variables for an assignment or a specific function. The operation performed varies depending on the type of item or the argument variable.

Inheritance:

Transferring the characteristics of a class to another class that dries out.

Instantiation: The production of instance of a class.

image.png
image.png

Method:

A special type of function described in the class definition.

Object:

A unique example of a data structure that is better suited to its class. An object contains both data members and methods.

Creating Classes:

The class statement creates a new class definition. The name of class immediately follows the keywords class followed by a colon.

class ClassName:

‘Optional class documentation string’

Calss-suite

image.png
image.png

Class Employee:

‘Common base class for all employees’
Empcount = 0
Def _ init_(self, name, salary):
Self.name=name
Self.salary=salary
Employee.empcount+= 1

Def displaycount(self):

Print “Total Employee %d” % Employee.empcount

image.png
image.png

Def displayEmployee(self):

Print”Name: “,self.name, “,self.salary

image.png
image.png

The variable emp count is a class variable whose alue is common to all instances outside of that class or calss. It can be accessed as Employee.empcount inside the classroom or outside the classroom.

Creating Instance Objects:

To create class examples, you call the class using the class name and pass whatever arguments it gives to the concepts
of _init_method.

Emp1.displayemployee():
Emp2.displayemployee():
Print “total employee %d” % employee.empcount

image.png
image.png

Now putting all togather:s

Class employee:

‘Common base class for all employee ‘
Empcount=0
Def_init__(self, name, salary):
Self.name=name
Self.salary=salary
Employee.empcount+= 1

Def displaycount(self):

Print “Total Employee %d” % Employee.empcount

image.png
image.png

Def displayEmployee(self):

Print”Name: “,self.name, “,self.salary

“This would create first object of Employee Class”
Emp1= Employee(“Zara,2000”)
“This would create second object of Employee Class”
Emp2= Employee(“Alia,3000”)
Emp1.displayEmployee()
Emp2.displayEmployee()
Print “total Employee %d” %Employee.empcount

image.png
image.png

Result is:

Name : Zara,salary:2000
Name:Alia,salary:3000

image.png

image.png



Thank You For Reading

image.png

I am Eligible for Club5050!

Normal Transfer and Transfer To Vesting;

image.png

image.png

image.png

Specially Mention:

@cryptokraze ADMIN Founder | Delegator (11K SP) ⭐⭐⭐
@vvarishayy MOD SIZ Staff | Delegator ⭐⭐⭐
@suboohi MOD SIZ Staff | Delegator ⭐⭐⭐
@endingplagiarism MOD SIZ Staff ⭐
@qasimwaqar MOD SIZ Investor & Sponsor ⭐
@siz-official MOD Community Account 🌍
@siz-rewards MOD Official Rewards Pool
@ashkhan MOD SIZ Staff | Delegator ⭐
@faran-nabeel MOD SIZ Staff | Delegator ⭐

Divider 2.png

Let’s add value to make A Better Steem Ecosystem for everyone

Steem Infinity Zone Team
@cryptokraze | @vvarishayy | @suboohi | @arie.steem | @qasimwaqar

Footer.png

Click Here to Join Official SIZ Discord Channel

Divider 2.png

image.png

Your Beloved! @hamzajameel

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!