Java 语言中面向对象特性.ppt

Java 语言中面向对象特性 TA: 栗志果 Email:zhiglee@ 一切皆对象 think in java 面向对象编程的基本概念和特征 什么是oop? 为什么要oop? Oop的一些基本概念 Oop的一些准则 1 例子:栈 1) 非面向对象方案 struct Stack { int top; int buffer[STACK_SIZE]; }; void init(Stack s) { s.top = -1; } bool push(Stack s, int i); { if (s.top == STACK_SIZE-1) { cout “Stack is overflow.\n”; return false; } else { s.top++; s.buffer[s.top] = i; return true; } } bool pop(Stack s, int i) { if (s.top == -1) { cout “Stack is empty.\n”; return false; } else { i = s.buffer[s.top]; s.top--; return true

文档评论(0)

1亿VIP精品文档

相关文档