error: expected primary-expression before ‘.‘ token << Book.displayMessage()

The wrong is like the below picture:

The reason is Book isn't Instantiation Object, it must Instantiation that it could call function, and you need know the Code must out of cout Codes blocksdisplayMessage() function include cout contents.

The repair Codes like the below program:
Output result:

Good Luck!! I hope the answer could solve your problem.

相关推荐
旖旎夜光26 分钟前
【C++ 基础入门】C++多态(下):单/多继承虚表、多态补充与 21 道高频题
开发语言·c++·笔记·学习
apcipot_rain11 小时前
C++转Java日记(03)
java·开发语言·c++
布莱克60511 小时前
C++ 中 map 的 insert 与 emplace:key 已存在时会覆盖吗?
开发语言·数据结构·c++·算法·map
xys_67811 小时前
深挖C++:类和对象(中)
开发语言·c++
D e re k ZH14 小时前
C++ 系统学习手记:从语法细节到工程实践
开发语言·数据结构·c++·算法
xiaoye-duck15 小时前
《C++ 项目:手写大模型接入 SDK》Ollama接口设计(上):初始化、全量响应实现和测试
开发语言·网络·c++·语言模型
zaizai100715 小时前
【Effective Modern C++】学习第一章
c++
Fruiticecake16 小时前
C 程序员速通现代 C++(一):lambda、std::function、移动语义与智能指针
c语言·c++
青少儿编程课堂16 小时前
蓝桥杯·全国青少年信息素养大赛·电子学会Python/C++考级:中缀表达式求值解析
c++·python·算法·bfs·信息学竞赛
坤坤子吖19 小时前
Linux网络编程:TCP服务器的多进程与多线程实现
linux·服务器·开发语言·网络·c++·笔记·学习