error: forming reference to void

The mistake is like the below picture:

The reason is Instantiation Object then call function, but displayMessage() function include cout function. After load this wrong, repair the Codes like the below picture:

The output result:

Good Luck!! I hope the answer could help you solve this problem.

相关推荐
人工智能AI技术30 分钟前
GitHub Copilot 2026新功能实操:C++跨文件上下文感知开发,效率翻倍技巧
c++·人工智能
大志若愚YYZ1 小时前
ROS2学习 C++中的this指针
c++·学习·算法
玖釉-2 小时前
[Vulkan 学习之路] 16 - 最终章:渲染循环与同步 (Rendering & Presentation)
c++·windows·图形渲染
狗狗学不会2 小时前
Pybind11 封装 RK3588 全流程服务:Python 写逻辑,C++ 跑并发,性能起飞!
c++·人工智能·python·目标检测
DYS_房东的猫2 小时前
《 C++ 零基础入门教程》第10章:C++20 核心特性 —— 编写更现代、更优雅的 C++
java·c++·c++20
Howrun7772 小时前
虚幻引擎_AController_APlayerController_AAIController
开发语言·c++·游戏引擎·虚幻
小林rr2 小时前
深入探索 C++:现代特性、工程实践与性能优化全解
java·c++·性能优化
羊小猪~~3 小时前
【QT】-- QT基础类
开发语言·c++·后端·stm32·单片机·qt
努力写代码的熊大3 小时前
深入探索C++关联容器:Set、Map、Multiset与Multimap的终极指南及底层实现剖析
开发语言·c++
txinyu的博客3 小时前
Linux 内存管理
linux·运维·开发语言·c++