# C++ Data Type Snippets

## Interfaces

For more information about interfaces in Unreal, [check out this wiki article](/4.25/wiki-archives/macros-and-data-types/interfaces-in-c++.md).

* You need to define two classes: `U<Name>` and `I<Name>`. The second class is what your C++ code will extend to implement the interface.

```cpp
UINTERFACE(BlueprintType)
class MYPROJECT_API UExample : public UInterface
{
  GENERATED_BODY()
};

class MYPROJECT_API IExample
{
  GENERATED_BODY()

public:

  UFUNCTION(BlueprintNativeEvent, BlueprintCallable)
  bool NativeEventExampleMethod();

  UFUNCTION(BlueprintImplementableEvent, BlueprintCallable)
  bool BlueprintEventExampleMethod();

};
```

## Structs

For more information about structs in Unreal, [check out this wiki article](/4.25/wiki-archives/macros-and-data-types/structs-ustructs-theyre-awesome.md).

* To access your struct from Blueprint, make sure to add the `BlueprintType` keyword to the `USTRUCT` macro.
* Structs must have a default constructor.
* It's Unreal coding standard to prefix your structs with a capital `F`.
* You cannot use the `UFUNCTION` macro with methods on structs.

```cpp
USTRUCT(BlueprintType)
struct MYPROJECT_API FExample
{
    GENERATED_BODY()
    
public:

    UPROPERTY(BlueprintReadOnly)
    int32 SomeValue;

};
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://unreal.gg-labs.com/4.25/quick-reference/c++-data-type-snippets.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
