POLYMORPHISM

Overloading:

Polymorphism with Function and Objects:

Vegetable
Orange
Fruit
Red

Polymorphism with Class Methods

Output

Inheritance

class Bird://base class Bird
def sound(self):
print("Birds Sounds")
#сhild сlаss Dоg inherits the bаse сlаss Аnimаl
class Sparrow(Bird)://child class Sparrow
def tweet(self):
print("sparrow tweeting")
d = Sparrow()
d.tweet()
d.sound()
Sparrow tweeting
Birds Sound

Method Overriding:

There are many types of birds.
Most of the birds can fly but some cannot.
There are many types of birds.
Sparrows can fly.
There are many types of birds.
Ostriches cannot fly.

--

--

--

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Nginx + GeoIP2 Load Balancer Example

Starting the journey with scalability, horizontally scaling with load balancing

Using service graphs to reduce MTTR in a HTTP-based architecture

Rails Code Challenge

How many devs do we need for the enterprise?

8 Key Challenges in Adopting DevOps: Part 1

Use If Over Select-Case Statement

[Leetcode]21:Merge Two Sorted Lists

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Harshini M

Harshini M

More from Medium

The “Low-block”

Benefits of Tree Planting: Social and Environmental

The Hardware Initiative (Part 6)

2022–05–05 Asia morning update (FOMC meeting recap, and then?)