web系统与技术实验6

web系统与技术实验6

ID:17311476

大小:53.50 KB

页数:4页

时间:2018-08-29

web系统与技术实验6_第1页
web系统与技术实验6_第2页
web系统与技术实验6_第3页
web系统与技术实验6_第4页
资源描述:

《web系统与技术实验6》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库

1、Web系统与技术实验报告(实验六)学号:姓名:实验项目名称:对象的创建教师评分:一、实验目的了解对象创建的几种方式二、预习内容及要求(要求写出预习内容)工厂模式创建对象的方法,存在的问题构造函数创建对象的方法,存在的问题原型模式创建对象的方法,存在的问题三、实验内容、操作过程及实验结果记录1.如果有一个java类Socket,其声明如下:classSocket{publicStringlocalAddress;//本地ip地址publicintlocalPort;//本地端口号publicintconnect(StringremoteAddress,intremotePort)//连接方法{r

2、eturnlocalPort;}}he"governingforthepeople","Nomattertheinterestsofthemasses"conceptunderstandingisnotinplace.Thespecificworktreatswiththedeployment,afewleadingcadrescomplainthatworkistoocomplicated,toomuchresponsibility,thepressureistoolarge,toomuchemphasisonthedifficultyofthework.Forexample,noncoal

3、mine请在javascript中分别使用工厂模式、构造函数模式和原型模式创建两个对象socket1和socket2,并为socket1和socket2初始化其成员变量。例如在java中,可以:Socketsocket1=newSocket();socket1.localAddress="192.168.1.20"socket1.localPort=9000Socketsocket2=newSocket();socket2.localAddress="202.116.1.30"socket2.localPort=100002.在三种模式创建的对象中,显示socket1和socket2的类型he

4、"governingforthepeople","Nomattertheinterestsofthemasses"conceptunderstandingisnotinplace.Thespecificworktreatswiththedeployment,afewleadingcadrescomplainthatworkistoocomplicated,toomuchresponsibility,thepressureistoolarge,toomuchemphasisonthedifficultyofthework.Forexample,noncoalmine3.编程证明:用三种模式创建出

5、的对象socket1和socket2,其中的connect方法,在socket1和socket2中是否是同一个方法he"governingforthepeople","Nomattertheinterestsofthemasses"conceptunderstandingisnotinplace.Thespecificworktreatswiththedeployment,afewleadingcadrescomplainthatworkistoocomplicated,toomuchresponsibility,thepressureistoolarge,toomuchemphasisont

6、hedifficultyofthework.Forexample,noncoalmine四、实验过程中所遇问题思考与讨论(可写个人体会,或相关理论知识,根据个人具体情况选做)he"governingforthepeople","Nomattertheinterestsofthemasses"conceptunderstandingisnotinplace.Thespecificworktreatswiththedeployment,afewleadingcadrescomplainthatworkistoocomplicated,toomuchresponsibility,thepressur

7、eistoolarge,toomuchemphasisonthedifficultyofthework.Forexample,noncoalmine

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。