1.无参属性 1.为什么有字段还需要属性呢? 因为字段很容易写出不恰当的代码,破坏对象的状态,比如Age=-1。人的年纪不可能为负数。使用属性后你可以缓存某些值或者推迟创建一些内部对象,你可以以线程安全的方式来访问字段,字段可能是一个逻辑字段,它的值需要某个方法类计算得到。 属性可以给set...
MVC 默认 Request 方式为 Post。actionpublic JsonResult GetPersonInfo(){var person = new{Name = "张三",Age = 22,Sex = "男"};returnJson(person);}或者public JsonResu...
分类:
Web程序 时间:
2014-10-20 11:19:30
阅读次数:
273
既然说到匿名类型超级实用,得要找到场景来说服一下,如果大家玩过php,里面有一个万能的关联数组array,任你在关联数组array里面怎么写,都可以用json_encode来生成json,非常非常的方便。"hxc","age"=20,"isMale"=>true); //也可以这么写 $...
分类:
其他好文 时间:
2014-10-20 00:47:39
阅读次数:
307
FirstName LastName BirthDay age Jim Green L.A 23 Andrew Hou Xi'an 25 Name Age Name Age ...
分类:
编程语言 时间:
2014-10-19 17:00:06
阅读次数:
216
由4张简单的不能再简单的表,演变出50道SQL表结构:表Student (S#,Sname,Sage,Ssex) 学生表S# student_no Sage student_age Ssex student_sex表Course(C#,Cname,T#) 课程表C# course_no Cname....
分类:
数据库 时间:
2014-10-19 15:31:45
阅读次数:
305
AngularJS 常用的功能第一 迭代输出之ng-repeat标签ng-repeat让table ul ol等标签和js里的数组完美结合 {{person.name}} is {{person.age}} years old. 你甚至可以指定输出的顺序:第二 动态绑定之ng-model...
分类:
Web程序 时间:
2014-10-19 12:50:16
阅读次数:
175
Suppose there are N people in ZJU, whose ages are unknown. We have some messages about them. The i-th message shows that the age of person si is
not smaller than the age of person ti. Now we need to...
分类:
其他好文 时间:
2014-10-19 02:43:17
阅读次数:
195
*** 类方法 ***声明和实现:@interface Person : NSObject+ (void) age; //声明一个类方法@end@implementation Person+ (void) age //类方法的实现{NSLog(@"abcd");}@endint main(){[P....
分类:
编程语言 时间:
2014-10-18 23:29:59
阅读次数:
253
// Student *stu=[[Student alloc]init];// [stu setValue:@12 forKey:@"age"];// [stu setValue:@14 forKey:@"_age"];// [stu setValue:@"zhangsan" forKey...
分类:
其他好文 时间:
2014-10-17 21:48:27
阅读次数:
197
#include
#include
using namespace std;
class Person
{
protected:
string name;
int age;
char sex;
public:
Person(string nam, char s,int a)
{
name=nam;
age=a;
sex=s;
}
void display()
{...
分类:
其他好文 时间:
2014-10-17 13:52:46
阅读次数:
174