2011年12月23日星期五

第6天 第1节: 面向对象(基础)

OOA: Analysis + OOD: Design + OOP: Programming

==Object Oriented Features
1. encapsulation
2. Inheritance
3. Polymorphism

==Class and objects
1. default properties and methods are public
2. don't have to have constructor and disconstructor
3. object creation steps
    step1: Person per=null;    ==> per is on stack
    step2: per = new Person();  ==> create object properties on heap
    Note: method on globl instruction area when class created.
4. reference
    Person per1 = new Person();
    Person per2 = new Person();
    Person per3 = per1;
    per2 = per1;  ==> the original object referred by per2 will be collected by java

没有评论: