C++第12章项目,ATM机模拟队列。

来源:互联网 发布:sybase数据库win7 64 编辑:程序博客网 时间:2024/06/16 12:16

//笔记:
这里写图片描述

c++中私有函数只能被自己的成员函数调用,而不能类外部的成员调用。
也就是说,类的对象是不能直接调用私有函数的。要间接调用。例如:
class base
{
private:
fun1();

public:
pubFunc1() { func1();} //输出base私有函数
};

int main()
{
base b;
……
b.pubFunc1(); //间接调用base类私有函数func1
}

出列:
bool Queue::dequeque(Item & item){
if(front == NULL)
return false;
item = front->item;
items–;
Node* temp = front;
front = front->next;
delete temp;
if(items == 0)
rear = NULL;
return true;
}

0 0