# Implement functions

If a class has a base class with pure virtual functions, it can't be instantiated unless it implements those functions. CLion creates stubs of the implemented functions, with the default return values for the primitive types, and null values for the objects.

Procedure: Implement required functions

1. From the main menu, select `Code | Implement functions` or press `Ctrl+I` (Windows), `⌃ I` (macOS), `⌘ I` (IntelliJ IDEA Classic (macOS)), `⌃ ⇧ I` (macOS System Shortcuts), `Ctrl+I` (XWin), `Ctrl+I` (GNOME), `Ctrl+I` (KDE), `Ctrl+I` (Emacs), `Ctrl+I` (Sublime Text), `Ctrl+I` (Sublime Text (macOS)), `⌘ ⌃ I` (Xcode), `Ctrl+Shift+I` (Visual Studio), `⌃ I` (Visual Studio (macOS)), `Ctrl+I` (ReSharper), `⌃ I` (ReSharper (macOS)), `Ctrl+I` (QtCreator), `⌃ I` (QtCreator (macOS)), `Ctrl+I` (NetBeans), `Alt+Shift+P` (Eclipse), `Ctrl+I` (Eclipse (macOS)). You can also right-click anywhere in the class  file, then click Generate `Alt+Insert` (Windows), `⌘ N` (macOS), `⌃ N` (IntelliJ IDEA Classic (macOS)), `⌘ N` (macOS System Shortcuts), `Alt+Insert` (XWin), `Alt+Insert` (GNOME), `Alt+Insert` (KDE), `Alt+Insert` (Emacs), `Alt+Insert` (Sublime Text), `⌘ N` (Sublime Text (macOS)), `⌘ N` (Xcode), `Alt+Insert` (Visual Studio), `⌘ ⌃ N` (Visual Studio (macOS)), `Alt+Insert` (ReSharper), `⌘ ⌃ N` (ReSharper (macOS)), `Alt+Insert` (QtCreator), `Alt+Insert` (QtCreator (macOS)), `Alt+Insert` (NetBeans), `Alt+Insert` (Eclipse), `⌘ N` (Eclipse (macOS)), and select Implement functions.

2. In the dialog that opens, select the functions to implement (hold the `Shift` or `Ctrl` key to perform a multi-selection). The list does not include the functions that are already implemented or cannot be accessed from the current class.

![Selecting functions to implement](https://resources.jetbrains.com/help/img/idea/2026.2/cl_codegen_implement.png)

## Change function body

The [code template](null) used for implementing functions (Implemented function body) accepts predefined template variables from the File Header include template (such as `${USER}`, `${DATE}`, and so on)

For example, consider the following file template:

```CPLUSPLUS
#if ($DEFAULT_RETURN_VALUE == "result")
$RETURN_TYPE result;
return result;#elseif ($RETURN_TYPE != "void")
return $DEFAULT_RETURN_VALUE;#end
```

This template expands into the following code:

```CPLUSPLUS
int Calendar::getMonth() {
    return 0;/// TODO (wombat, 1/22/2015):To change the body of an implemented function, use File | Settings - Editor -  File and Code Templates.
}

void Calendar::setMonth(int month) {
    /// TODO (wombat, 1/22/2015):To change the body of an implemented function, use File | Settings - Editor -  File and Code Templates.
}
```

