zoukankan      html  css  js  c++  java
  • 基本概念

    面向对象

    • 面向对象不是面向过程的取代,而是完善。
    • 类、对象、字段、方法
    1. 类是抽象的,对象是具体的,对象是类的实例(Instance)
    2. 字段(Field):和某个对象相关联的变量
    3. 方法:类能执行的动作。
    4. 类的继承:
     1 namespace ConsoleApplication2
     2 {
     3     class Program
     4     {
     5         static void Main(string[] args)
     6         {
     7             //相当于DAL、BLL接收处理。
     8             Person p = new Person();
     9             p.Name = "垂坠";
    10             p.Age = 20;
    11             p.SayHello();
    12             Console.ReadKey();
    13         }
    14     }
    15     class Person//实体类Entity,人类共有的
    16     {
    17         public string Name { set; get; }
    18         public int Age { set; get; }
    19         public void SayHello()
    20         {
    21             Console.WriteLine("我是{0},我的年龄是{1}",this.Name,this.Age);
    22         }
    23     }
    24 }
    View Code

      5.成员访问级别

        类的成员(字段、属性、方法)

      6.属性

    1  public string name;
    2         public string Name//没有保存和获取数据
    3         {
    4             set { this.name = value; }
    5             get { return this.name}
    6         }
    View Code

  • 相关阅读:
    flash 异性窗体
    ASCⅡ 表 关键字符
    VC 中显示位图的步骤
    输出电脑的所有Mac地址
    const char* 和 char* const
    C# 生成PDF
    vc6显示行号
    纪念一下。
    MII接口全家福
    Virtex6 GTX设计总结:预加重、均衡、输出振幅的值
  • 原文地址:https://www.cnblogs.com/chuizhuizhigan/p/3210620.html
Copyright © 2011-2022 走看看