关联关系与依赖关系的区别
一、语义上:
关联关系:
A has a(knows a) B
依赖关系:
A uses a B
二、代码上:
关联关系:
package facade;
/**
* @author Administrator
* @version 1.0
* @created 11-十月-2015 18:42:05
*/
public class A {
public B m_B;(or public B * pm_B)
public A(){
}
public void finalize() throws Throwable {
}
}
依赖关系:
package facade;
/**
* @author Administrator
* @version 1.0
* @created 11-十月-2015 18:44:06
*/
public class A {
public A(){
}
public void finalize() throws Throwable {
}
/**
*
* @param obj
*/
public int process(B m_B(or B * pm_B)){
return 0;
}
}
博学之,审问之,慎思之,明辨之,笃行之。