<?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>C++ virtual functions | Student Projects</title>
	<atom:link href="https://studentprojects.in/tag/c-virtual-functions/feed/" rel="self" type="application/rss+xml" />
	<link>https://studentprojects.in</link>
	<description>Microcontroller projects, Circuit Diagrams, Project Ideas</description>
	<lastBuildDate>Sat, 13 Mar 2010 18:04:10 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.1.7</generator>
	<item>
		<title>C++ program to implement Pure Virtual Functions</title>
		<link>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-advanced/c-program-to-implement-pure-virtual-functions/</link>
					<comments>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-advanced/c-program-to-implement-pure-virtual-functions/#comments</comments>
		
		<dc:creator><![CDATA[Editorial Team]]></dc:creator>
		<pubDate>Sat, 13 Mar 2010 18:04:10 +0000</pubDate>
				<category><![CDATA[Advanced programs]]></category>
		<category><![CDATA[derived class]]></category>
		<category><![CDATA[Pure Virtual Functions]]></category>
		<category><![CDATA[C++ virtual functions]]></category>
		<category><![CDATA[Examples]]></category>
		<category><![CDATA[base class]]></category>
		<guid isPermaLink="false">http://studentprojects.in/?p=1068</guid>

					<description><![CDATA[<p>AIM A program to demonstrate how a pure virtual function is defined, declared and invoked from the object of derived class through the pointer of the base class. ALGORITHM 1. Start the process 2. Invoke the class with pointer 3. Assign ptrgetdata() a. Get the roll no and name of the student 5. Call the</p>
<p>The post <a href="https://studentprojects.in/software-development/cpp/cpp-programs/cpp-advanced/c-program-to-implement-pure-virtual-functions/">C++ program to implement Pure Virtual Functions</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></description>
										<content:encoded><![CDATA[<p><strong>AIM</strong><br />
	A program to demonstrate how a pure virtual function is defined, declared and invoked from the object of derived class through the pointer of the base class.</p>
<p><strong>ALGORITHM</strong></p>
<p>1.	Start the process<br />
2.	Invoke the class with pointer<br />
3.	Assign ptr<-&#038;obj
4.	Call the ptr->getdata()<br />
a.	Get the roll no and name of the student<br />
5.	Call the ptr->display()<br />
a.	Print the roll no and name<br />
6.	Stop the process</p>
<p><strong>PROGRAM</strong></p>
<pre lang="cpp">
#include<iostream.h>
	#include<conio.h>

	class  base 
	{
		private: int x;
			float y;
		public : virtual void getdata( );
			virtual void display( );
	};
	class dev : public base
	{
		private:  int roll;
			 char name[20];
		public : void getdata( );
			void  display( );
	};	
	void base :: getdata( )  {  }
	void base :: display( )   {  }
			
	void dev :: getdata( )
	{
		cout<<” Enter Roll of  the Student “;
		cin>> roll;
		cout<<” Enter name of  the student”;
		cin>>name;
        }
	void dev :: display( )
	{
		cout<<”Name is :”<<name<<endl;
		cout<<” Roll no is :”<<roll <<endl;
	}
			
	void main( )
	{
		base * ptr;
		dev obj;
		clrscr( );
		ptr = &obj;
		ptr -> getdata( );
		ptr -> display( );
		getch( );
	}
</pre>
<p><strong>OUTPUT</strong></p>
<p>Enter the roll no of the student: 111<br />
Enter the name of the student : Kapil Dev</p>
<p>Name is : Kapil Dev<br />
Roll no is : 111</p><p>The post <a href="https://studentprojects.in/software-development/cpp/cpp-programs/cpp-advanced/c-program-to-implement-pure-virtual-functions/">C++ program to implement Pure Virtual Functions</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-advanced/c-program-to-implement-pure-virtual-functions/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
	</channel>
</rss>
