# -*- coding: utf-8 -*-
"""
Created on Fri Jan 22 21:48:01 2021
day 24:classes
@author: anil durgam
class engine():
def piston():
print("piston")
class carbody(engine):
engine.piston()
def seats():
print("seats")
carbody()
class engine():
def __init__(self,name,lastname):
self.name=name
self.lastname=lastname
#print(self.name)
def piston(self):
print(self.name,self.lastname)
class carbody(engine):
def __init__(self):
pass
def seats(self):
print("seats")
#carbody()
s=engine("raju","kumar")
s.piston()
class engine():
def __init__(self,name,lastname):
self.name=name
self.lastname=lastname
#print(self.name)
def piston(self):
print(self.name,self.lastname)
class carbody(engine):
def __init__(self,name,lastname):
engine.__init__(self,name,lastname)
#def seats(self):
#print(self.name,self.lastname)
def seatbelt():
print("This is seatbelt method")
class backseat():
def backseats(self):
print("back seat method is working")
x=carbody("honda","spender")
x.piston()
"""
class engine():
def __init__(self,name,lastname):
self.name=name
self.lastname=lastname
#print(self.name)
def piston(self):
print(self.name,self.lastname)
class carbody(engine):
def __init__(self,name,lastname):
super().__init__(name,lastname)
#def seats(self):
#print(self.name,self.lastname)
def seatbelt():
print("This is seatbelt method")
class backseat():
def backseats(self):
print("back seat method is working")
x=carbody("honda","spender")
x.piston()
No comments:
Post a Comment