22
2014-12-11 23:13
162 查看
//Javascript Code : User add/delete information var member = function(userId, name, sex, age, password, remark){ this.userId = userId; this.name = name; this.sex = sex; this.age = age; this.password = password; this.remark = remark; }; member.prototype = { addInfo:function(userId, infoBody, date){ //addInfo(userId, infoBody, date); }, deleteInfo:function(infoId){ //deleteInfo(infoId); }, addComment:function(userId, commentBody, date){ //addComment(userId, commentBody, date); }, deleteComment:function(commentId){ //deleteComment(commentId)'' }, addLike:function(userId, infoId){ //addLike(userId, infoId); }, deleteLike:function(likeId){ //deleteLike(likeId); } } function user(){ member.call(this); this.isAdmin = false; } user.prototype = new member(); function admin(name, sex, age, password, isAdmin, remark){ member.call(this); this.isAdmin = true; } admin.prototype = new member(); admin.prototype.addUser = function(userName, userPwd){ //addUser(userName, userPwd); } admin.prototype.deleteUser = function(userId){ //deleteUser(userId); } //create user & admin var User = new user(1, 'user', 1, 22, '123456', 0, 'this is a normal user.'); var Admin = new admin(2 , 'admin', 1, 22, '123456', 0, 'this is a super admin.'); //addinfo //if success, console.log('this is a information by user at 2014-12-10'); User.addInfo(1, 'this is a information', new Date('2014-12-10')); //addComment //if success, console.log('this is a comment by user at 2014-12-10'); User.addComment(1, 'this is a comment', new Date('2014-12-10')); //deleteLike //if success, console.log('the likeId 2 has been delete.'); User.deleteLike(2); //deleteUser //if success, console.log('the userId 1 has been deleted by admin.'); admin.deleteUser(1);
相关文章推荐
- ssh: connect to host 172.16.36.81 port 22: No route to host
- BUG!!!======> DD-wrt ssh : connect to ...... port 22:Connection refused
- 记录点滴22(过去一年的个人总结)
- 10-22数据库 复习
- 100-22
- (22)21.2.11 加入一个线程join()
- Daily Scrum 11/22
- 算法导论 Chapter 22 Ex 22.3-6
- 为22-29岁的人解释一下什么叫工作(转)
- ssh: connect to host localhost port 22: Connection refused
- 我的模块加载系统 v22
- jquerymobile-22 方法
- 新概念系列之《Part2 Lesson 22 A glass envelope》
- C 求完数 水仙花数 完全平方数 素数 2+22+222... PI
- ipv6环境下python报[Errno 22] Invalid argument
- 关于在Android2.3中mediarecoder.play 报start fail -22错误的原因
- H3C AR18-22 ADSL上网配置与QOS策略
- 数学之路(2)-数据分析-R基础(22)
- Android入门进阶教程(22)-系统广播 BroadcastReceiver详解
- 设计(22) 人体关节肿胀度测试设计