当前位置: 首页 > news >正文

【虚幻C++笔记】接口

目录

  • 概述
  • 创建接口

概述

  • 简单的说,接口提供一组公共的方法,不同的对象中继承这些方法后可以有不同的具体实现。
  • 任何使用接口的类都必须实现这些接口。
  • 实现解耦
  • 解决多继承的问题

创建接口

在这里插入图片描述

// Fill out your copyright notice in the Description page of Project Settings.#pragma once#include "CoreMinimal.h"
#include "UObject/Interface.h"
#include "MyInterface.generated.h"// This class does not need to be modified.
UINTERFACE(MinimalAPI)
class UMyInterface : public UInterface
{GENERATED_BODY()
};/*** */
class GENERALFRAMEWORK_API IMyInterface
{GENERATED_BODY()// Add interface functions to this class. This is the class that will be inherited to implement this interface.
public:
// 纯虚函数,实现类必须实现接口virtual void MyInterface_PureVirtual() = 0;// 虚函数,在接口本身的 .h 或 .cpp 文件中提供默认实现.实现类可覆盖virtual void MyInterface_Virtual();//实现类可以在蓝图和C++中实现接口UFUNCTION(BlueprintCallable, BlueprintNativeEvent)void MyInterface_NativeEvent1(int32 number);//实现类在蓝图中实现接口UFUNCTION(BlueprintCallable, BlueprintImplementableEvent)void MyInterface_ImplementableEvent();
};
http://www.dtcms.com/a/136024.html

相关文章:

  • MySQL联表查询底层原理
  • http/https请求解析
  • Pikachu靶场——Cross-Site Scripting
  • 需求分析---软件架构师武器库中的天眼系统
  • 记录小程序第一次调用Api,基于腾讯云Serverless函数,实现小程序的成功接入api,以及数据调用
  • 实验四 中断实验
  • 【Linux】第七章 控制对文件的访问
  • 实现类似 “更新中” 的水平进度条按钮效果
  • 高级java每日一道面试题-2025年4月10日-微服务篇[Nacos篇]-Nacos的服务健康检查机制是如何工作的?
  • 下载maven低版本(官网)
  • 网站301搬家后谷歌一直不收录新页面怎么办?
  • maven如何解决jar包依赖冲突
  • Maven 多仓库和多镜像配置
  • 红宝书第四十七讲:Node.js服务器框架解析:Express vs Koa 完全指南
  • 408 计算机网络 知识点记忆(9)
  • 【今日三题】添加字符(暴力枚举) / 数组变换(位运算) / 装箱问题(01背包)
  • 阿里云短信服务与ASP.NET对接实例
  • 21、c#中“?”的用途
  • TDengine 语言连接器(R语言)
  • 【QT】常用控件 【多元素类 | 容器类 | 布局类】
  • 【n8n docker 部署的代理问题】解决n8n部署无法访问openai等外国大模型厂商的api
  • 入门-C编程基础部分:5、变量
  • MyBatis-Plus 中BaseMapper接口是如何加速微服务内部开发的?
  • 在ubuntu20.04+系统部署VUE及Django项目的过程记录——以腾讯云为例
  • HADOOP——序列化
  • 高并发多级缓存架构实现思路
  • 施磊老师基于muduo网络库的集群聊天服务器(一)
  • 微软承认Win11出现极端错误,只能强制关机或重装系统
  • typescript html input无法输入解决办法
  • 《Not All Tokens Are What You Need for Pretraining》全文翻译