Horje
demonstrating polymorphism in python class Code Example
demonstrating polymorphism in python class
class India():
    def capital(self):
        print("New Delhi is the capital of India.")
 
    def language(self):
        print("Hindi is the most widely spoken language of India.")
 
    def type(self):
        print("India is a developing country.")
 
class USA():
    def capital(self):
        print("Washington, D.C. is the capital of USA.")
 
    def language(self):
        print("English is the primary language of USA.")
 
    def type(self):
        print("USA is a developed country.")
 
obj_ind = India()
obj_usa = USA()
for country in (obj_ind, obj_usa):
    country.capital()
    country.language()
    country.type()




Python

Related
opencv cartoonizer script Code Example opencv cartoonizer script Code Example
assigning a value to a character in string or text file in python Code Example assigning a value to a character in string or text file in python Code Example
typecasting inpython Code Example typecasting inpython Code Example
def print_menu():    print{'1. Kilometers to Miles')    print{'2. Miles to Kilometers'} Code Example def print_menu(): print{'1. Kilometers to Miles') print{'2. Miles to Kilometers'} Code Example
how to get quarter year date in pandas Code Example how to get quarter year date in pandas Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
7