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.

相关推荐
2301_8042154112 小时前
模板元编程应用场景
开发语言·c++·算法
炘爚12 小时前
C++(普通指针和成员的区别、指针的使用场景和存储内容)
数据结构·c++·算法
松☆12 小时前
C++ 控制台通讯录管理系统 —— 从零实现到完整解析(附可运行代码)
开发语言·网络·c++
炘爚12 小时前
C++(在Mystring类中碰到的构造函数和析构函数以及深拷贝和浅拷贝的问题)
开发语言·c++·算法
hz_zhangrl12 小时前
CCF-GESP 等级考试 2026年3月认证C++四级真题解析
c++·程序设计·gesp·c++四级·gesp2026年3月·gesp c++四级
liulilittle13 小时前
TC Hairpin NAT 驱动使用手册(个人版)
服务器·开发语言·网络·c++·网络协议·tcp/ip·tc
njidf13 小时前
C++与量子计算模拟
开发语言·c++·算法
计算机安禾13 小时前
【数据结构与算法】第12篇:栈(二):链式栈与括号匹配问题
c语言·数据结构·c++·学习·算法·visual studio code·visual studio
灰子学技术13 小时前
C++ 代码质量检测工具集合技术文档
开发语言·c++