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.

相关推荐
筱璦2 小时前
期货软件开发 - C# 调用 HQChart 指标计算 C++ 动态库
c++·microsoft·c#
不想写代码的星星2 小时前
C++ 内存管理:分区、自定义分配器、常见问题与检测工具
c++
-许平安-3 小时前
MCP项目笔记九(插件 bacio-quote)
c++·笔记·ai·plugin·mcp
沉鱼.443 小时前
第十三届题目
c语言·c++·算法
liulilittle4 小时前
C++ 无锁编程:单停多发送场景高性能方案
服务器·开发语言·c++·高性能·无锁·原子
无限进步_4 小时前
【C++】巧用静态变量与构造函数:一种非常规的求和实现
开发语言·c++·git·算法·leetcode·github·visual studio
小超超爱学习99374 小时前
大数乘法,超级简单模板
开发语言·c++·算法
xyx-3v5 小时前
qt创建新工程
开发语言·c++·qt
样例过了就是过了6 小时前
LeetCode热题100 爬楼梯
c++·算法·leetcode·动态规划
少司府6 小时前
C++基础入门:类和对象(中)
c语言·开发语言·c++·类和对象·运算符重载·默认成员函数