- 博客(7)
- 收藏
- 关注
转载 JAVA – 虚函数、抽象函数、抽象类、接口
JAVA – 虚函数、抽象函数、抽象类、接口1. Java虚函数虚函数的存在是为了多态。C++中普通成员函数加上virtual关键字就成为虚函数Java中其实没有虚函数的概念,它的普通函数就相当于C++的虚函数,动态绑定是Java的默认行为。如果Java中不希望某个函数具有虚函数特性,可以加上final关键字变成非虚函数PS: 其实C++和Java在虚函数的观点大同小异
2014-07-10 11:30:23 499
原创 Java 实现二叉树的建立以及前、中、后序遍利
import java.util.Scanner;class Node{ Node lchild,rchild; int data; Node() { }}public class Linkdemo{ Scanner input = new Scanner(System.in); public Node creat(Node root,int
2014-07-08 23:40:50 741
原创 Java 链表的小应用
class Students{ String name; int age; Students(String name,int age) { this.name=name; this.age=age; } void showinfo() { System.out.println("姓名"+this.name+"年龄"+this.age); }
2014-07-08 18:21:57 783
转载 java中引用的原理
在Java中的引用类型,是指除了基本的变量类型之外的所有类型,所有的类型在内存中都会分配一定的存储空间(形参在使用的时候也会分配存储空间,方法调用完成之后,这块存储空间自动消失), 基本的变量类型只有一块存储空间(分配在stack中), 而引用类型有两块存储空间(一块在stack中,一块在heap中), 方法形参的值传递(引用)是指形参和传进来的参数指向同一个值的内存(heap)中;jav
2014-07-07 00:23:25 591
原创 Creat Binary Tree and by means of Postorder and Preorder through the Tree
#define NULL 0#include "stdio.h"#include "stdlib.h"//二叉链表结点定义typedef struct tree { int data; struct tree *lchild; struct tree *rchild; }*TREE;// 先序建立二叉树struct tree *create(struct t
2014-07-02 01:14:56 497
原创 函数对象的学习
#include#include#include#include#includeusing namespace std;templateclass Sumpower{ private: int power; public: Sumpower(int p):power(p){} const T operator()( const T& total,const T&
2014-07-01 16:28:34 412
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人