摘要: 1.实验任务4 Vector.hpp 1 #pragma once 2 #include <iostream> 3 #include <stdexcept> 4 5 using namespace std; 6 7 template<typename T> 8 class Vector { 9 pu 阅读全文
posted @ 2024-12-20 15:54 sssshan 阅读(18) 评论(0) 推荐(0)
摘要: 1. 实验任务1 验证性实验:编译时多态(静态绑定)vs. 运行时多态(动态绑定) 这个练习模拟出版物的分类,涵盖了类的组合、继承、运行时多态。 代码: publisher.hpp 1 #pragma once 2 3 #include <iostream> 4 #include <string> 阅读全文
posted @ 2024-12-08 15:17 sssshan 阅读(33) 评论(0) 推荐(0)
摘要: 一、实验目的 1.知道什么是类模板,会正确定义和使用简单的类模板 2.会使用C++正确定义、使用派生类 3.加深对类的组合机制(has-a)、类的继承机制(is-a)的领悟和理解 4.练习标准库string, vector用法,能基于问题场景灵活使用 5.针对具体问题场景,练习运用面向对象思维进行设 阅读全文
posted @ 2024-11-24 21:33 sssshan 阅读(41) 评论(0) 推荐(0)
摘要: 一、实验目的 加深对OOP中类、对象的理解,能够解释类的封装、类的接口 会使用C++语法规则正确定义、实现、测试类;会使用类创建对象,并基于对象编程 针对具体问题场景,练习运用面向对象思维进行设计,合理利用C++语言特性(访问权限控制, static, friend, const),在数据共享和保护 阅读全文
posted @ 2024-10-28 21:01 sssshan 阅读(54) 评论(0) 推荐(0)
摘要: //任务1 1 #include <iostream> 2 #include <string> 3 #include <vector> 4 #include <algorithm> 5 6 using namespace std; 7 8 //声明 9 //模板函数声明 10 11 template 阅读全文
posted @ 2024-10-13 19:03 sssshan 阅读(21) 评论(0) 推荐(0)