UltraDebug

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
热搜: A C D R G Y M Z X S P
公益项目,接受捐赠
查看: 2426|回复: 0
收起左侧

[C] 分享一个C、C++代码片段

[复制链接]
guixin

主题

0

回帖

UD

新手上路

UID
43
积分
34
注册时间
2022-5-18
最后登录
1970-1-1
2022-7-20 14:57:23 | 显示全部楼层 |阅读模式
供正在学习c、c++的新手参考

继承
enum class ItemType : short {
None,
ProcessCreate,
ProcessExit
};
struct ItemHeader {
ItemType Type;
USHORT Size;
LARGE_INTEGER Time;
};
struct ProcessExitInfo : ItemHeader {
ULONG ProcessId;
ULONG ExitCode;
};
纯C无继承
struct ProcessExitInfo {
ItemHeader Header;
ULONG ProcessId;
};
模板类型
template<typename T>
struct FullItem {
LIST_ENTRY Entry;
T Data;
};
// 扩展union的数据成员实现多种类型。
struct ItemData : ItemHeader {
union {
ProcessCreateInfo ProcessCreate; // TBD
ProcessExitInfo ProcessExit;
};
};
UltraDebug免责声明
✅以上内容均来自网友转发或原创,如存在侵权请发送到站方邮件9003554@qq.com处理。
✅The above content is forwarded or original by netizens. If there is infringement, please send the email to the destination 9003554@qq.com handle.
回复 打印

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|Archiver|站点地图|UltraDebug ( 滇ICP备2022002049号-2 滇公网安备 53032102000034号)

GMT+8, 2025-6-16 18:19 , Processed in 0.030781 second(s), 10 queries , Redis On.

Powered by Discuz X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表