在不同包,子类继承后可以使用父类的protect权限的属性或方法父类:package
com.tinyphp;public class Father{ protected String name;}子类:package
com.test;import com.tinyphp.Father;cl...
分类:
编程语言 时间:
2014-05-13 18:19:55
阅读次数:
404
import java.util.Scanner;
// 并查集 判断一个图中有几个联通块
public class UnionFind {
private int[] father;//
private int count;// 分量数量
public UnionFind(int N){
count=N;
father=new int[N];
for(int i=0;i<N...
分类:
其他好文 时间:
2014-05-11 03:03:44
阅读次数:
308
对象伪装来实现继承。在这里先来说一下这种方式的优缺点
这种方式是比较容易理解的,在子类中调用父类的构造函数。另外,这种方法最大的一个优点就是说构造继承可以实现多继承,复习下这个代码:function A(){
}function B(){ }function C(){this.father=A;th...
分类:
编程语言 时间:
2014-05-09 09:16:14
阅读次数:
304
OJ题目:click here~~
树上的01背包
const int maxn = 102;
int val[maxn];
int w[maxn];
vector g[maxn];
int dp[maxn][maxn];
int n , m ;
void dfs(int u , int father){
int v , i , j , k;
for(i = w[u];i...
分类:
其他好文 时间:
2014-05-08 05:09:28
阅读次数:
323