当前位置: 首页 > news >正文

网站a记录的是做cname简述网站开发技术

网站a记录的是做cname,简述网站开发技术,最近最新的新闻,免费的域名和网站课程目标 理解松耦合设计思想掌握面向对象设计原则掌握重构技法改善设计掌握GOF核心设计模式 什么是设计模式 目标#xff1a;复用#xff0c;以不变应万变 GOF设计模式 从面向对象谈起 深入理解面向对象 向下#xff1a;深入理解三大面向对象机制 封装#xff1a;隐藏…课程目标 理解松耦合设计思想掌握面向对象设计原则掌握重构技法改善设计掌握GOF核心设计模式 什么是设计模式 目标复用以不变应万变 GOF设计模式 从面向对象谈起 深入理解面向对象 向下深入理解三大面向对象机制 封装隐藏内部实现继承复用现有代码多态改写对象行为 向上深刻把握面向对象机制所带来的抽象意义理解如何使用这些机制来表达现实世界掌握什么是“好的面向对象设计” 软件设计固有的复杂性 软件设计复杂的根本原因 变化 客户需求的变化技术平台的变化开发团队的变化市场环境的变化… 如何解决复杂性 分解 人们面对复杂性有一个常见的做法即分而治之将大问题分解为多个小问题将复杂问题分解为多个简单问题。 抽象 更高层次来讲人们处理复杂性有一个通用的技术即抽象。由于不能掌握全部的复杂对象我们选择忽视它的非本质细节而去处理泛化和理想化了的对象模型。 结构化 VS. 面向对象 分解将问题具体化 /* * file: Shape1.h */class Point { public:int x;int y; };class Line { public:Point start;Point end;Line(const Point start, const Point end) {this-start start;this-end end;} };class Rect { public:Point leftUp;int width;int height;Rect(const Point leftUp, int width, int height) {this-leftUp leftUp;this-width width;this-height height;} };// 增加 // 新图形 class Circle {};/* * file: MainForm1.cpp */class MainForm : public Form { private:Point p1;Point p2;vectorLine lineVector; // 直线vectorRect rectVector; // 矩形// 改变// 增加一个vector专门存储圆vectorCircle circleVector; // 圆public:MainForm() {// ...} protected:virtual void OnMouseDown(const MouseEventArgs e);virtual void OnMouseUp(const MouseEventArgs e);virtual void OnPaint(const PaintEventArgs e); };void MainForm::OnMouseDown(const MouseEventArgs e) {p1.x e.X;p1.y e.Y;// ...Form::OnMouseDown(e); }void MainForm::OnMouseUp(const MouseEventArgs e) {p2.x e.X;p2.y e.Y;if (rdoLine.Checked) { // 如果是要画线Line line(p1, p2);lineVector.push_back(line);}else if (rdoRect.Checked){ // 如果是要画矩形int width abs(p2.x - p1.x);int height abs(p2.y - p1.y);Rect rect(p1, width, height);rectVector.push_back(rect);}// 改变else if (...) { // 如果是要画圆// ...circleVector.push_back(circle);}// ...this-Refresh();Form::OnMouseUp(e); }void MainForm::OnPaint(const PaintEventArgs e) {// 针对直线for (int i 0; i lineVector.size(); i) {e.Graphics.DrawLine(Pens.Red,lineVector[i].start.x, lineVector[i].start.y,lineVector[i].end.x,lineVector[i].end.y);}// 针对矩形for (int i 0; i rectVector.size(); i) {e.Graphics.DrawRectangle(Pens.Red,rectVector[i].leftUp,rectVector[i].width,rectVector[i].height);}// 改变// 针对圆形for (int i 0; i circleVector.size(); i) {e.Graphics.DrawCircle(Pens.Red,circleVector[i]);}// ...Form::OnPaint(e); }抽象运用面向对象的继承与多态特性使用统一的处理方式来提高代码的复用性 /* * file: Shape2.h */// 基类 class Shape { public:// 虚函数由子类overridevirtual void Draw(const Graphics g) 0;// 析构函数也要是virtualvirtual ~Shape() { } };class Point { public:int x;int y; };// 派生类继承Shape class Line: public Shape { public:Point start;Point end;Line(const Point start, const Point end) {this-start start;this-end end;}// 实现自己的Draw负责画自己virtual void Draw(const Graphics g) {g.DrawLine(Pens.Red, start.x, start.y, end.x, end.y);} };// 派生类继承Shape class Rect: public Shape { public:Point leftUp;int width;int height;Rect(const Point leftUp, int width, int height) {this-leftUp leftUp;this-width width;this-height height;}// 实现自己的Draw负责画自己virtual void Draw(const Graphics g){g.DrawRectangle(Pens.Red,leftUp, width, height);} };//增加 class Circle : public Shape{ public://实现自己的Draw负责画自己virtual void Draw(const Graphics g) {g.DrawCircle(Pens.Red,...);} };/* * file: MainForm2.cpp */class MainForm : public Form { private:Point p1;Point p2;// 针对所有形状注意这里是基类指针Shape*而非基类对象// 目的是利用多态用父类指针指向子类对象vector中可以存储所有子类对象的指针vectorShape* shapeVector;public:MainForm() {//...} protected:virtual void OnMouseDown(const MouseEventArgs e);virtual void OnMouseUp(const MouseEventArgs e);virtual void OnPaint(const PaintEventArgs e); };void MainForm::OnMouseDown(const MouseEventArgs e) {p1.x e.X;p1.y e.Y;// ...Form::OnMouseDown(e); }void MainForm::OnMouseUp(const MouseEventArgs e) {p2.x e.X;p2.y e.Y;if (rdoLine.Checked) {shapeVector.push_back(new Line(p1,p2)); // 将Line*指针放入shapeVector中}else if (rdoRect.Checked) {int width abs(p2.x - p1.x);int height abs(p2.y - p1.y);shapeVector.push_back(new Rect(p1, width, height)); // 将Rect*指针放入shapeVector中}// 改变else if (...){// ...shapeVector.push_back(circle); // 将Circle*指针放入shapeVector中}// ...this-Refresh();Form::OnMouseUp(e); }void MainForm::OnPaint(const PaintEventArgs e) {// 针对所有形状for (int i 0; i shapeVector.size(); i) {shapeVector[i]-Draw(e.Graphics); //多态调用各负其责}// ...Form::OnPaint(e); }软件设计的目标 什么是好的软件设计软件设计的金科玉律复用
http://www.w-s-a.com/news/351604/

相关文章:

  • 开福区城乡建设局门户网站关键词挖掘查询工具爱站网
  • 网站建设全国排名沈阳seo按天计费
  • 成都公司网站设计无锡seo网站推广费用
  • 建网站平台要多少钱购物网站界面设计策划
  • 学完js了可以做哪些网站长沙建站官网
  • 怎么样做问卷网站多少钱英语
  • 房产网站建设方案建筑公司是干什么的
  • wordpress建的大型网站柳州市网站建设
  • 石家庄做网站的公司有哪些微信自媒体网站建设
  • 池州哪里有做网站注册公司有哪些风险
  • 做古代风格头像的网站对网站政务建设的建议
  • 网站搜索栏怎么做设计个网站要多少钱
  • 阿里巴巴网站建设目标wamp wordpress
  • 自己做的网站怎么挂网上金蝶erp
  • 网站的页面由什么组成淘宝网网站建设的需求分析
  • 软文网站推广法dede5.7内核qq个性门户网站源码
  • 个人备案网站名称校园网站建设特色
  • vr超市门户网站建设班级网站怎么做ppt模板
  • 网站建设一般是用哪个软件刚开始做写手上什么网站
  • 用jsp做的网站源代码下载有哪些做红色旅游景点的网站
  • 网站开发的技术选型黄石市网站建设
  • 做直播网站需要证书吗专做宝宝的用品网站
  • 网站标题用什么符号网站制作交易流程
  • dede模板网站教程jsp网站搭建
  • 上海网站开发外包公司鲜花导购网页制作
  • 宿州外贸网站建设公司个人注册网站一般做什么
  • 小公司做网站用哪种服务器什么是网站代理
  • 青岛李村网站设计公司cms建站平台
  • 做saas网站可行吗许昌抖音推广公司
  • 网站建设找谁做seo基础知识培训