c#第三章
来源:互联网 发布:mac os x 10.7 .2 iso 编辑:程序博客网 时间:2024/06/01 07:33
1.opp三大支柱封装(Encapsulation),多态(Polymorphism),继承(Inheritance)
2.
默认情况下,类声明为内部的,即只有当前项目中的代码才能访问它
internal class MYclass2 { }
类是公共的,可由其他中的项目访问
public class MYclass { }
内部类(internal)可以继承于公共类(public),反之不行
3.
突然想到c++中的运算符重载
priority_queue<pii,vector<pii>,greater<pii> >que;
如果用priority_queue<pii>que,后面的参数编译器自动填好了
4.
如果没有写构造函数,编译器自动创建并赋值
Type
Default value
numeric(int,long,etc.)
0
bool
false
char
'\0' (null)
enum
0
reference
null
5.
静态函数:
Static method cannot access anon-static member variable.
因为没法确定非静态函数是否被实例化
Guaranteed that the stati cconstructor will run before any instance of the class is created.
静态类是密封的(sealed)不能从它派生(derive)类型。
6.
class myclass { private int myProperty; /*public int myproperty { get { return this.myProperty; } set { this.myProperty = value; } }*/ public int myproperty { get; set; } } class Program { static void Main(string[] args) { myclass cur = new myclass(); cur.myproperty = 1; Console.WriteLine(cur.myproperty); } }
7.
readonly成员只能在下面的两种情况下被赋值:
1. Static constructor
2. A variable initializer
0 0
- c#第三章
- C# .NET 第三章
- c# 宝典 第三章 学习
- C#第三章示例6
- C#第三章上机3
- C#第三章上机3
- 第三章 C#语言基础(1)
- 第三章 C#语言基础(2)
- C#第三章 对象和类型
- C# 编程规范 第三章 程序注释
- 第三章C#变量和表达式
- C#入门经典—第三章
- c#第二章课后第三题
- c#第三章升级属性MyBank
- c#第三章上机题2-3
- c#第三章课后作业3
- C# 第三章 查询学生信息 示例
- c#开发数据库第三章上级4
- Redis内存管理的基石zmallc.c源码解读(二)
- android:gravity 和 android:layout_gravity 区别
- git in linux(1)
- eval与json.loads对json的处理小记
- 做好自己
- c#第三章
- 百度地图POI检索实例
- MyBatis配置多个数据源
- 第四周 阅读程序
- Remove Duplicates from Sorted List
- Ember.js 入门指南 (一)
- python 之文件操作
- 学会成长
- leetcode-98 Validate Binary Search Tree