<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>inheritance oops Archives -</title>
	<atom:link href="https://mitindia.in/tag/inheritance-oops/feed/" rel="self" type="application/rss+xml" />
	<link>https://mitindia.in/tag/inheritance-oops/</link>
	<description></description>
	<lastBuildDate>Sun, 12 Apr 2020 12:30:05 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://mitindia.in/wp-content/uploads/2023/03/cropped-android-chrome-512x512-1-32x32.png</url>
	<title>inheritance oops Archives -</title>
	<link>https://mitindia.in/tag/inheritance-oops/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Single and Multiple inheritance in Python</title>
		<link>https://mitindia.in/single-and-multiple-inheritance-in-python/</link>
		
		<dc:creator><![CDATA[SKB]]></dc:creator>
		<pubDate>Sun, 12 Apr 2020 12:08:00 +0000</pubDate>
				<category><![CDATA[Artificial Intelligence]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[inheritance oops]]></category>
		<guid isPermaLink="false">http://www.mitindia.in/?p=1048</guid>

					<description><![CDATA[<p>Single and Multiple inheritance in Python 1.  Single Inheritance  # Single Inheritance in Python with Student and Marks Details #-Base class class std_per_det: regno = input("Enter RegNo:") name = input("Enter Name:") course = input("Enter Course:") #Base class Method def show_std(self): print('Base Class value:',self.regno) print('Base Class value:',self.name) print('Base Class value:',self.course) #-Derived class class marks_det(std_per_det): p=int(input("Enter Physics [&#8230;]</p>
<p>The post <a href="https://mitindia.in/single-and-multiple-inheritance-in-python/">Single and Multiple inheritance in Python</a> appeared first on <a href="https://mitindia.in"></a>.</p>
]]></description>
										<content:encoded><![CDATA[<h1>Single and Multiple inheritance in Python</h1>
<p><span style="color: #993300;"><strong>1.  Single Inheritance </strong></span></p>
<pre class="EnlighterJSRAW" data-enlighter-language="null"># Single Inheritance in Python with Student and Marks Details

#-Base class 
class std_per_det:
    regno = input("Enter RegNo:")
    name = input("Enter Name:")
    course = input("Enter Course:")
    
#Base class Method
    def show_std(self):
        print('Base Class value:',self.regno)
        print('Base Class value:',self.name)
        print('Base Class value:',self.course)
 
#-Derived class 
class marks_det(std_per_det):
    p=int(input("Enter Physics Marks:"))
    c=int(input("Enter Chemistry Marks:"))
    m=int(input("Enter Maths Marks:"))
    b=int(input("Enter Biology Marks:"))
    tot=p+c+m+b
    avg=tot/4

#Derive class Method
    def show_marks(self):
        print('Physics:',self.p)
        print('Chemistry:',self.c)
        print('Maths:',self.m)
        print('Biology:',self.b)
        print('Total Marks:',self.tot)
        print('Average Marks:',self.avg)
        
 
print("\nStudent Marks details")
print("=================================")
m=marks_det()  # Object of Derive class
m.show_std()   # Access Base class method
m.show_marks()  
</pre>
<p><strong>Output</strong></p>
<p><img fetchpriority="high" decoding="async" class="alignnone size-medium wp-image-1055" src="http://www.mitindia.in/wp-content/uploads/2020/04/si-287x300.png" alt="" width="287" height="300" srcset="https://mitindia.in/wp-content/uploads/2020/04/si-287x300.png 287w, https://mitindia.in/wp-content/uploads/2020/04/si.png 433w" sizes="(max-width: 287px) 100vw, 287px" /></p>
<p><span style="color: #993300;"><strong>2. Multiple Inheritance </strong></span></p>
<pre class="EnlighterJSRAW" data-enlighter-language="null"># Multiple Inheritance - Inventory example 
#Base class - item_det
class item_det:
    icode=input("Enter item code:")
    iname=input("Enter item Name:")

    def show_item_det(self):
        print("Item code:", self.icode)
        print("Item name:",self.iname)

#Base class - bill_det
class bill_det:
    qty=int(input("Enter Qty:"))
    price=int(input("Enter Price:"))
    tot=qty*price
    
    def show_bill_det(self):
       print("Item Qty:",self.qty)
       print("Item Price:",self.price)
       print("Total:",self.tot)

#Child class invent_det Begins with inheriting Base classes item_det and bill_det
class invent_det(item_det, bill_det):
    tax=bill_det.tot*18/100
    bill_amt=bill_det.tot+tax

    def show_invent_det(self):
        print("TAX 18%:",self.tax)
        print("Total amount:",self.bill_amt)

print("Inventory details")
print("---------------------------------")
i=invent_det() #Child class instance

i.show_item_det() # invoking parent class item_det method
i.show_bill_det() # invoking parent class bill_det method
i.show_invent_det() #invoking own class method
</pre>
<p><strong>Output</strong></p>
<p><img decoding="async" class="alignnone size-medium wp-image-1056" src="http://www.mitindia.in/wp-content/uploads/2020/04/mi-300x208.png" alt="" width="300" height="208" srcset="https://mitindia.in/wp-content/uploads/2020/04/mi-300x208.png 300w, https://mitindia.in/wp-content/uploads/2020/04/mi.png 440w" sizes="(max-width: 300px) 100vw, 300px" /></p>
<p><a class="a2a_button_whatsapp" href="https://www.addtoany.com/add_to/whatsapp?linkurl=https%3A%2F%2Fmitindia.in%2Fsingle-and-multiple-inheritance-in-python%2F&amp;linkname=Single%20and%20Multiple%20inheritance%20in%20Python" title="WhatsApp" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fmitindia.in%2Fsingle-and-multiple-inheritance-in-python%2F&amp;linkname=Single%20and%20Multiple%20inheritance%20in%20Python" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fmitindia.in%2Fsingle-and-multiple-inheritance-in-python%2F&#038;title=Single%20and%20Multiple%20inheritance%20in%20Python" data-a2a-url="https://mitindia.in/single-and-multiple-inheritance-in-python/" data-a2a-title="Single and Multiple inheritance in Python"><img src="https://static.addtoany.com/buttons/favicon.png" alt="Share"></a></p><p>The post <a href="https://mitindia.in/single-and-multiple-inheritance-in-python/">Single and Multiple inheritance in Python</a> appeared first on <a href="https://mitindia.in"></a>.</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
