📄 list2.h
字号:
// Borland C++ - (C) Copyright 1991 by Borland International
// list2.h: A Integer List Class
// from Hands-on C++
const int Max_elem = 10;
class List
{
protected: // The protected keyword gives subclasses
// direct access to inherited members
int *list; // An array of integers
int nmax; // The dimension of the array
int nelem; // The number of elements
public:
List(int n = Max_elem) {list = new int[n]; nmax = n; nelem = 0;};
~List() {delete list;};
int put_elem(int, int);
int get_elem(int&, int);
void setn(int n) {nelem = n;};
int getn() {return nelem;};
void incn() {if (nelem < nmax) ++nelem;};
int getmax() {return nmax;};
virtual void print(); // line 22
};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -