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

深圳定制工作装seo优化网络推广

深圳定制工作装,seo优化网络推广,wordpress这个博客,青浦区网站建设本文仅作学习笔记与交流#xff0c;不作任何商业用途#xff0c;作者能力有限#xff0c;如有不足还请斧正 本系列旨在通过补全学习之后#xff0c;给出任意类图都能实现并做到逻辑上严丝合缝 1.继承方法 C# Unity 面向对象补全计划 之 继承#xff08;字段与属性不作任何商业用途作者能力有限如有不足还请斧正 本系列旨在通过补全学习之后给出任意类图都能实现并做到逻辑上严丝合缝 1.继承方法 C# Unity 面向对象补全计划 之 继承字段与属性-CSDN博客 本文讲述继承方法与多态性是继承的重要伴随知识 我想实现如下内如 有一个Computer类和一个Mycomputer类作为子类 父类提供推荐配置而子类提出我自己的配置并打印 1.1构造函数继承 子类构造函数会默认先调用父类构造函数 举个栗子 Computer类 class Computer {// 公共字段public string cpu ;// 私有字段private string gpu ;// 公共属性public string gpu_name {get gpu;set gpu value;}// 公共构造函数public Computer() {cpu 7500f及以上;gpu_name Rx580及以上;Console.WriteLine({0},{1},cpu,gpu_name);}// 公共自定义方法public virtual void Configuration() {} } 当我执行Computer类的对象时会输出如下 子类继承  也可以用base关键词进行父类构造函数调用用的不多故不做演示 class MyComputer : Computer {public MyComputer() {cpu 5600;gpu_name 3060;Console.WriteLine({0},{1}, cpu, gpu_name);} } 子类对象 输出 如果父类构造函数是私有的话就无法使用子类构造函数了 Q我可以在调用子类构造函数的时候不调用父类构造函数吗 A不行因为这是语言设计的一部分用于确保父类的成员被正确初始化 1.2方法继承 我将Computer类添加了一个自定义方法并将输出语句放到方法里 class Computer {// 公共字段public string cpu ;// 私有字段private string gpu ;// 公共属性public string gpu_name {get gpu;set gpu value;}// 公共构造函数public Computer() {cpu 7500f及以上;gpu_name Rx580及以上;}// 公共自定义方法public void Configuration() {Console.WriteLine({0},{1}, cpu, gpu_name);} } 如果子类继承以后写一个相同名字的方法会输出什么 MyComputer mycomputer new MyComputer(); mycomputer.Configuration(); class Computer {// 公共字段public string cpu ;// 私有字段private string gpu ;// 公共属性public string gpu_name {get gpu;set gpu value;}// 公共构造函数public Computer() {cpu 7500f及以上;gpu_name Rx580及以上;}// 公共自定义方法public void Configuration() {Console.WriteLine({0},{1}, cpu, gpu_name);} }class MyComputer : Computer {public MyComputer() {cpu 5600;gpu_name 3060;}public void Configuration(){Console.WriteLine({0},{1}, cpu, gpu_name);} } 不会继承所以如果不做特殊处理的话只会调用自己的方法 所以就用到了多态直接跳到标题3多态下 2.多态上 2.1方法重载 是指可以出现同名方法规则如下 public class Example {public void Print(int a) { }public void Print(int a, int b) { }public void Print(double a) { }public void Print(int a, double b) { }public void Print(double a, int b) { } }2.2运算符重载  运算符重载一般也用的不多先用现学即可  public static Complex operator (Complex c1, Complex c2) {return new Complex(c1.Real c2.Real, c1.Imaginary c2.Imaginary); }public static Complex operator (Complex c1, Complex c2) {return new Complex(c1.Real c2.Real, c1.Imaginary c2.Imaginary); }3.多态下 3.1虚方法可以不重写 在C#中虚方法virtual method是指在基类中声明并可以在派生类中重写的方法 虚方法使用 virtual 关键字进行声明: public virtual void Configuration() {Console.WriteLine(推荐配置为{0},{1}, cpu, gpu_name);} 子类可以使用override关键字进行重写并且添加逻辑 public override void Configuration(){ Console.WriteLine(我的配置为{0},{1}, cpu, gpu_name);Console.WriteLine(打印完毕);} 调用 Computer computer new Computer(); computer.Configuration(); MyComputer mycomputer new MyComputer(); mycomputer.Configuration(); 结果 3.2抽象方法强制重写 抽象方法没有方法体只包含在抽象类之中只有方法签名它们必须在派生类中实现 举个栗子:电脑这一概念的确就符合抽象的概念 abstract class Computer {// 公共字段public string cpu ;// 私有字段private string gpu ;// 公共属性public string gpu_name {get gpu;set gpu value;}// 公共构造函数public Computer() {cpu 7500f及以上;gpu_name Rx580及以上;}// 公共自定义方法public abstract void Configuration(); } 子类继承的话则强制进行方法重写 public override void Configuration(){ Console.WriteLine(我的配置为{0},{1}, cpu, gpu_name);Console.WriteLine(打印完毕);} 二者区别
http://www.hkea.cn/news/14386017/

相关文章:

  • 招标网最新招标公告百度网站如何优化排名
  • 云霄网站建设wordpress 谷歌字体 360
  • 如何制作推广网站哪个网站可以做一对一老师
  • wordpress 站群软件做网站要会哪些知识
  • 网站建设的主要作用wordpress等待响应
  • 网站建设必须要服务器吗昆明网站建设织梦
  • 商城网站怎么做内链劳务派遣做网站的好处
  • 网站开发课程设计参考文献网站源码商城
  • wordpress 站外调用毕业设计网站建设选题依据
  • 杭州营销型网站pc端网站建设价格明细表
  • 生态文明建设网站专题培训石家庄做网站公司
  • 品牌建设的规划与实施汕头seo公司
  • 企业做网站要多少钱百度网盘搜索引擎网站
  • 建设集团招聘网站优化外包公司
  • 企业网站seo运营口碑营销方案怎么写
  • 网站空间是指什么住建综合管理平台
  • 网站建设设计贵吗微信小程序源码网站
  • 印刷网站开发策划书微信电子宣传册制作app
  • 搜索引擎和门户网站的区别全球十大摄影作品
  • 广州网站开发招聘信息soso搜搜
  • 庐江住房建设局网站开发公司网签的流程
  • 兰陵网站建设网站建设软文推广
  • 翡翠原石网站首页怎么做做黑网站赚钱吗
  • 安徽省建设安全协会网站某商贸网站建设方案
  • 入境游旅游网站建设大连新图闻科技
  • 东莞做网站公司百度竞价推广课程
  • 庆阳网站设计 贝壳下拉wordpress主题academy
  • 个人网站怎样做超链接家在深圳坪山
  • 广告最多的网站响应式自助建站平台
  • 受欢迎的永州网站建设wordpress发文章的id怎么不连续