You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
helpviewer_keywords: ["/interface", "Translate include directives into import directives"]
9
+
---
10
+
# `/interface`
11
+
12
+
This switch instructs the compiler to treat the input file on the command line as a module interface unit.
13
+
14
+
## Syntax
15
+
16
+
> **`/interface`***`filename`*
17
+
18
+
## Remarks
19
+
20
+
Use this switch when a module interface has a different extension than `.ixx`.
21
+
22
+
In the following example, the module interface has a `.cppm` extension instead of `.ixx`, so the `/interface` switch is used to compile it as a module interface:
The compiler derives the name for the generated `.ifc` file from the module interface name. For example, given a module name `MyModule` defined in `my-module.cppm`, the generated `.ifc` will be named `MyModule.ifc`.
29
+
30
+
This switch must be used in with the [`/TP` (Specify source file type)](tc-tp-tc-tp-specify-source-file-type.md) compiler flag.
31
+
32
+
**`/interface`** is available in Visual Studio 2019 version 16.10, or later.\
33
+
**`/interface`** requires [/std:c++20](std-specify-language-standard-version.md) or later.
34
+
35
+
## See also
36
+
37
+
[Overview of modules in C++](../../cpp/modules-cpp.md)\
38
+
[Using C++ Modules in MSVC from the Command Line](https://devblogs.microsoft.com/cppblog/using-cpp-modules-in-msvc-from-the-command-line-part-1/)
This switch can't be used with the [`/interface`](interface.md) compiler switch.
47
+
48
+
**`/internalPartition`** is available in Visual Studio 2019 version 16.10, or later.\
49
+
**`/internalPartition`** requires [/std:c++20](std-specify-language-standard-version.md) or later.
50
+
51
+
## See also
52
+
53
+
[Overview of modules in C++](../../cpp/modules-cpp.md)\
54
+
[Using C++ Modules in MSVC from the Command Line](https://devblogs.microsoft.com/cppblog/using-cpp-modules-in-msvc-from-the-command-line-part-1/)\
55
+
[C++ Modules conformance improvements with MSVC in Visual Studio 2019 16.5](https://devblogs.microsoft.com/cppblog/c-modules-conformance-improvements-with-msvc-in-visual-studio-2019-16-5/#module-partitions)
The accessibility of an interface outside the assembly. Possible values are **`public`** and **`private`**. **`private`** is the default. Nested interfaces cannot have an *interface_access* specifier.
25
+
*`interface_access`*\
26
+
The accessibility of an interface outside the assembly. Possible values are **`public`** and **`private`**. **`private`** is the default. Nested interfaces can't have an *`interface_access`* specifier.
27
27
28
-
*name*<br/>
28
+
*`name`*\
29
29
The name of the interface.
30
30
31
-
*inherit_access*<br/>
32
-
The accessibility of *base_interface*. The only permitted accessibility for a base interface is **`public`** (the default).
31
+
*`inherit_access`*\
32
+
The accessibility of *`base_interface`*. The only permitted accessibility for a base interface is **`public`** (the default).
33
33
34
-
*base_interface*<br/>
35
-
(Optional) A base interface for interface *name*.
34
+
*`base_interface`*\
35
+
(Optional) A base interface for interface *`name`*.
36
36
37
37
### Remarks
38
38
39
-
**interface struct** is equivalent to **interface class**.
39
+
**`interface struct`** is equivalent to **`interface class`**.
40
40
41
41
An interface can contain declarations for functions, events, and properties. All interface members have public accessibility. An interface can also contain static data members, functions, events, and properties, and these static members must be defined in the interface.
42
42
43
-
An interface defines how a class may be implemented. An interface is not a class and classes can only implement interfaces. When a class defines a function declared in an interface, the function is implemented, not overridden. Therefore, name lookup does not include interface members.
43
+
An interface defines how a class may be implemented. An interface isn't a class and classes can only implement interfaces. When a class defines a function declared in an interface, the function is implemented, not overridden. Therefore, name lookup doesn't include interface members.
44
44
45
-
A class or struct that derives from an interface must implement all members of the interface. When implementing interface *name* you must also implement the interfaces in the `base_interface` list.
45
+
A `class` or `struct` that derives from an interface must implement all members of the interface. When implementing interface *`name`*, you must also implement the interfaces in the *`base_interface`* list.
For information on other CLR types, see [Classes and Structs](classes-and-structs-cpp-component-extensions.md).
54
54
55
-
You can detect at compile time if a type is an interface with `__is_interface_class(type)`. For more information, see [Compiler Support for Type Traits](compiler-support-for-type-traits-cpp-component-extensions.md).
55
+
You can detect at compile time if a type is an interface with `__is_interface_class(type)`. For more information, see [Compiler support for type traits](compiler-support-for-type-traits-cpp-component-extensions.md).
56
56
57
-
In the development environment, you can get F1 help on these keywords by highlighting the keyword, (**`interface class`**, for example) and pressing F1.
57
+
In the development environment, you can get F1 help on these keywords by highlighting the keyword (for example, **`interface class`**) and pressing **F1**.
0 commit comments