---
title: "How to create pure virtual function?"  
description: "How to create pure virtual function?"  
author: "Anonymous User"  
published: 2010-10-16  
updated: 2020-09-14  
canonical: https://www.mindstick.com/interview/35/how-to-create-pure-virtual-function  
category: "visual c++"  
tags: ["visual c++"]  
reading_time: 1 minute  

---

# How to create pure virtual function?

public:virtual void virtualfunctioname() = 0 //This denotes the pure virtual function in C++

## Answers

### Answer by Anonymous User

\

In inheritance if the base class contains a virtual function equating to zero, it is known also as do-nothing function & that base class is called as abstract base class as there are no instances or objects can be created by this base class. And this pure virtual can be filled with the codes in successiv derived classes accordin to the user requirements. A pure virtual function is a function that has the notation "= 0" in the declaration of that function. Why we would want a pure virtual function and what a pure virtual function looks like is explored in more detail below.

\
**The Syntax of the pure virtual function is**

```
class class_name { visibility mode:\\should be protected:  virtual return_type function_name()=0; } new class_name : inheritance_type old class_name { ............... }
```

### Answer by Uttam Misra

public:virtual void virtualfunctioname() = 0 //This denotes the pure virtual function in C++


---

Original Source: https://www.mindstick.com/interview/35/how-to-create-pure-virtual-function

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
