CodeBus
www.codebus.net
Search
Sign in
Sign up
Hot Search :
Source
embeded
web
remote control
p2p
game
More...
Location :
Home
Search - 任务与函数代码
Main Category
SourceCode
Documents
Books
WEB Code
Develop Tools
Other resource
Sub Category
GUI Develop
Windows Kernel
WinSock-NDIS
Driver Develop
ADO-ODBC
GDI-Bitmap
CSharp
.net
Multimedia Develop
Communication
Shell api
ActiveX/DCOM/ATL
IME Develop
ISAPI-IE
Hook api
Screen saver
DirextX
Process-Thread
Console
File Operate
Printing program
Multi Monitor
DNA
Other
Search - 任务与函数代码 - List
[
Other
]
MyArray
DL : 0
动态数组及模板类 任务目标: 学习C++的类机制、模板机制、运算符重载、重载函数机制、内存动态分配与释放等。 任务描述: 使用C++的类机制实现一个动态的数组类MyArray,具有完整的构造和析构函数。使用模板机制,使其能够支持各种数据类型(包括结构体)。MyArray类中实现以下方法: 添加一个元素,使用函数重载的方式,实现1)添加数组尾部,2)添加到指定序号位置; 通过函数,设置指定位置(序号)的元素数据; 删除指定序号的元素; 删除所有元素; 获得元素个数 通过函数获取指定序号的元素; 重载运算符‘[]’,可以通过序号引用数组元素。 实现以上功能的动态数组类,并设计测试代码,验证实现的所有功能。要求数组元素的数据类型为自定义的数据结构,如“学生信息”。 任务提示: 添加元素时用new分配空间,删除时用delete删除空间-Dynamic arrays and template class mission objectives: learning class mechanism C++, the template mechanism, operator overloading, function overloading mechanism, such as dynamic memory allocation and deallocation. Task Description: Use C++ class mechanism to implement a dynamic array class MyArray, with full constructor and destructor functions. Using the template mechanism to support a variety of data types (including structures). MyArray class implements the following methods: add an element, the use of function overloading way to achieve a) to add an array of tail, 2) to specify the ordinal position through the function, setting the specified location (number) of the element data delete the specified number of Elements delete all the elements obtain the number of elements specified number of elements to get through the function overloaded operator ' []' , array elements can be referenced by number. Achieve more dynamic array class functionality and design test code, verif
Date
: 2025-12-29
Size
: 10.02mb
User
:
周畅
CodeBus
is one of the largest source code repositories on the Internet!
Contact us :
1999-2046
CodeBus
All Rights Reserved.