ITInterviews.net
Search for  
 
Advanced Search
  Home | Add a Link | Modify a Link | Login | Register | New Listings | Most Popular | Top Ranked | Link to Us | Search | Site Map

C++

Call Centers
Call Center Software
Call Center Consultants
Call Center Equipment
Call Center Outsourcing


Complete SAP Interview Questions
Complete Java EJB .NET Interview Questions
Complete Oracle 10g DBA Interview Questions



Conference Call
Conference Calling Service 
Conference Call Providers 
Phone Conferencing
Auto Dialers 
Software Escrow 
Dedicated Hosting 
Web Conferencing 
TeleConferencing 
Business Phone Systems 
Document Shredding 
Website Monitoring 
Domain Name Registration 
Answering Services
Website Monitoring 
Mesothelioma Cancer
Mesothelioma Compensation
Malignant Mesothelioma
Car Accident Lawyer
C++

Home > Interview Questions > C++

 

C++ Interview Questions Page 4

<<Previous Next>>

What is virtual function?
When derived class overrides the base class method by redefining the same function, then if client wants to access redefined the method from derived class through a pointer from base class object, then you must define this function in base class as virtual function.
class parent
{
void Show()
{
cout << "i'm parent" << endl;
}
};
class child: public parent
{
void Show()
{
cout << "i'm child" << endl;
}
};
parent * parent_object_ptr = new child;
parent_object_ptr->show() // calls parent->show() i
now we goto virtual world...
class parent
{
virtual void Show()
{
cout << "i'm parent" << endl;
}
};
class child: public parent
{
void Show()
{
cout << "i'm child" << endl;
}
};
parent * parent_object_ptr = new child;
parent_object_ptr->show() // calls child->show()
What is pure virtual function? or what is abstract class?
When you define only function prototype in a base class without and do the complete implementation in derived class. This base class is called abstract class and client won't able to instantiate an object using this base class.
You can make a pure virtual function or abstract class this way..
class Boo
{
void foo() = 0;
}
Boo MyBoo; // compilation error

<<Previous Next>>

Confined Topics to C++
 
Related Topics to C++
Other Sites for C++
Submit your link

 

Send more about C++
Send us your comments on C++, if you want to share your knowledge on C++. We will publish it on this site

Home Hardware Internet Information Technology Interview Questions Logistics Services Software Telecom




Partner Sites:  Java Interview Questions | SAP Interview Questions | Oracle DBA Interview Questions | Cisco Study Guides | CompTIA Braindumps | MCSE Braindumps | Oracle Certification | Exact Questions | IT Interview Questions | Free Oracle Training | Cheap Study Guides

Microsoft MCSE Resources  |   Cisco CCNA Resources  |   Orace OCP Resources  |   PMP Resources  |   CISSP Resources  |   Citrix Resources  |   CIW Resources  |   CompTIA A+ Resources  |   Linux Resources  |   Java SCJP Resources  |   Resources Index  |   Free Programming Tutorials  |   Free .net Training