算法导论–第二章 merge sort java代码实现 1 public class Sort { 2 public static void main(String[] args){ 3 int[] arr = new int[]{8,30,19,1,45,...
分类:
其他好文 时间:
2015-05-13 12:01:06
阅读次数:
95
转载:http://shitouer.cn/2010/06/method-called/代码如下:#include “stdlib.h”int sum(int a,int b,int m,int n){return a+b;}void main(){int result = sum(1,2,3,4)...
分类:
编程语言 时间:
2015-05-13 11:59:48
阅读次数:
266
1、带有Render的方法返回值是void,在方法内部进行输出;不带的返回值类型为MvcHtmlString,所以只能这样使用:@Html.Partial 对应 @{Html.RenderPartial(....);}@Html.Action 对应 @{Html.RenderAction(....)...
分类:
Web程序 时间:
2015-05-13 11:58:54
阅读次数:
146
public static void testAppend() { StringBuffer sb = new StringBuffer("This is a StringBuffer!"); sb.append(1.23f); Syst...
分类:
移动开发 时间:
2015-05-13 11:56:15
阅读次数:
601
//正确使用虚析构函数
//使用虚析构函数,当delete删除一个对象时,能确保析构函数正确执行(动态)
#include
using namespace std;
class B
{
public:
B()
{
cout<<"B"<<endl;
}
virtual void fun()
{
cout<<"B::fun()"<<endl;
}
virtual ~B()
/...
分类:
编程语言 时间:
2015-05-13 10:41:38
阅读次数:
136
//派生类对象初始化基类的引用
//引用是别名,但这个别名只能包含派生类对象中的由基类继承来的隐藏对象
#include
using namespace std;
class B
{
public:
B()
{
cout<<"B"<<endl;
}
void fun()
{
cout<<"B::fun()"<<endl;
}
private:
int x;
};
cla...
分类:
编程语言 时间:
2015-05-13 10:40:21
阅读次数:
241
//
// 可以将一个派生类的对象的地址赋给其基类的指针变量,但只能通过这个指针访问派生类中由基类继承来的隐藏对象,
//不能访问派生类中的新成员。同样也不能反过来做。
#include
using namespace std;
class B
{
public:
B()
{
cout<<"B"<<endl;
}
void fun()
{
cout<<"B::fun()"<<...
分类:
编程语言 时间:
2015-05-13 10:40:20
阅读次数:
162
//子类在重写虚函数时,会覆盖父类的函数
#include
using namespace std;
class B
{
public:
B()
{
cout<<"Create B!"<<endl;
}
public:
virtual void fun()
{
cout<<"B::fun()"<<endl;
}
virtual void show()
{
cout<<...
分类:
编程语言 时间:
2015-05-13 10:39:52
阅读次数:
105
//继承派生中对象相互赋值情况
//派生类的对象可以赋值给基类的对象,这时是把派生类对象中从对应基类中继承来的隐藏对象赋值给基类对象。
//反过来不行,因为派生类的新成员无值可赋。
#include
using namespace std;
class B
{
public:
B()
{
cout<<"B"<<endl;
}
void fun()
{
cout<<"B::fu...
分类:
编程语言 时间:
2015-05-13 10:39:31
阅读次数:
141
上一节,我对NSOperation的基本概念及使用进行了介绍,想要了解的,请点击这里。本节中,我介绍自定义NSOperation实现多线程异步下载图片,类似于SDWebImage。
自定义NSOperation的步骤很简单,重写 - (void)main方法,在里面实现想执行的任务。
重写 - (void)main方法注意点:
1.自己创建自动释放池(因为如果是异步操作,无法访问...
分类:
其他好文 时间:
2015-05-13 10:22:54
阅读次数:
207