错误原因:
exc_bad_access(code=1, address=0x789870)野指针错误,主要的原因是,当某个对象被完全释放,也就是retainCount,引用计数为0后。再去通过该对象去调用其它的方法就会出现野指针错误。
例如:
Person *jerry = [[Person alloc]init]; // retainCount引用计数为1
[jerry eat];...
分类:
移动开发 时间:
2014-07-22 23:05:16
阅读次数:
372
function Animal(name) {
this.name = name;
}
Animal.prototype.eat = function(food) {
console.log("food");
};
Animal.prototype.getName = function()
{
return this.name;
};
var a = new An...
分类:
Web程序 时间:
2014-05-26 05:21:44
阅读次数:
345
【题目】
Given an array of strings, return all groups of strings that are anagrams.
Note: All inputs will be in lower-case.
For example:
Input: ["tea","and","ate","eat","den"]
Output: ["tea","ate","eat"]
【题意】
anagrams指的是颠倒字母顺序构成的单词,以tea为例,则与它an...
分类:
其他好文 时间:
2014-05-24 18:36:01
阅读次数:
317
什么是继承?在面向对象中,继承就是一个类得到了另外一个类当中的成员变量和成员方法。Java当中只支持单继承,不允许多继承使用继承是为了减少重复代码,并且易于修改举例:父类Person3class
Person3{ String name; int age; void eat...
分类:
移动开发 时间:
2014-05-17 22:58:32
阅读次数:
328
插头DP,多条回路求回路数。
可以当作模版来记。注重理解轮廓线。
#include
#include
#include
#include
using namespace std;
const int HASH=10007;
const int STATE=5000; //状态数
const int MAXD=15;
int code[MAXD],maze[MAXD][MAXD];...
分类:
其他好文 时间:
2014-05-15 11:23:33
阅读次数:
344
#include
using namespace std;
class Animal
{
public:
Animal() {}
void eat()
{
cout << "eat\n";
}
protected:
void play()
{
cout << "play\n";
}...
分类:
其他好文 时间:
2014-05-15 06:21:51
阅读次数:
234
#include
using namespace std;
class Animal //动物类
{
public:
Animal() {}
void eat(){
cout << "eat\n";
}
protected:
void play()
{
cout << "play\n";
...
分类:
其他好文 时间:
2014-05-15 06:02:54
阅读次数:
360
抽象类(abstract class) 描述抽象的事物, 比如人类(human), 就是一个抽象类.
对于人类这个抽象类, 具体的就是某一个人, 比如张三(男)啊, 小红(女)啊,虽然说人都会eat,
可是男人和女人的eat似乎又是不一样的.男人一般都是大口大口的吃, 而女人比较慢条斯理. ...
分类:
编程语言 时间:
2014-05-01 00:10:59
阅读次数:
439