1. in c#

readonly can be delayed to initialize in constructor.

2. in c++

totally no readonly.

Many people have mastered c++ before c#. They are the managers.

So many of the interview are about the difference of c# and c++.

I am always confused about the interview problems since I never use it before.

Such as readonly. In c#, there are no pointer, we don't need const and readonly actually.

All you need to do is set a All caps up variable name as a field. such as:

class A

{

double MYPI=0.7;

}

I am sure none will try to change it in the methods. The same for static. Only one way I will use static:

when I need to use a static method. That is all. Please forget the differece of static readonly and const.

We don't need it totally.

When I interviewed with Microsoft one year ago.

I am aware of that, the most important things of c# are all in Effective C#.

If you understand all items, you understand how to use c#.

Readonly and other things about C++的更多相关文章

  1. C#基础知识七之const和readonly关键字

    前言 不知道大家对const和readonly关键字两者的区别了解多少,如果你也不是很清楚的话,那就一起来探讨吧!探讨之前我们先来了解静态常量和动态常量. 静态常量 所谓静态常量就是在编译期间会对变量 ...

  2. const 与 readonly知多少

    原文地址: http://www.cnblogs.com/royenhome/archive/2010/05/22/1741592.html 尽管你写了很多年的C#的代码,但是可能当别人问到你cons ...

  3. IOS 杂笔-15(知识小点 readonly)

    readonly是我们并不陌生的属性. 但是他也有值得我们注意的地. 属性如其名-只读-也就是说我们只能读取-不能进行写操作 当我们尝试进行写操作时会如下 但是这并不意味着我们不可以改变其内部的属性 ...

  4. 1.2 - C#语言习惯 - 用运行时常量readonly而不是编译期常量const

    C#中有两种类型的常量:编译期常量和运行时常量.二者有着截然不同的行为,使用不当将会带来性能上或正确性上的问题. 这两个问题最好都不要发生,不过若难以同时避免的话,那么一个略微慢一些但能保证正确的程序 ...

  5. 表单中Readonly和Disabled的区别

    1.readonly是要锁定这个控件,通过在界面上无法修改他(但是通过javascript可以修改他). 2.disabled和readonly有相同的地方也是可以锁定这个控件用户不能改变他的值,但是 ...

  6. C# readonly 与const

    引自:http://www.cnblogs.com/ryuasuka/p/3342282.html?utm_source=tuicool&utm_medium=referral 现在正在学&l ...

  7. js让text值不可改变,同<input type="text" readonly="readonly" />

    <input type="text" size="60"  name="j01" value="www.52jscn.com ...

  8. [c#基础]关于const和readonly常见的笔试题剖析

    引言 有那么几天没更新博客了,发现到了不得不写的地步,总是有那么个声音在强迫自己,虽然工作很累,但是有些东西不写出来,不能原谅自己.今天为什么总结这两个关键字的区别,总觉得这两个关键字的用法用的太习惯 ...

  9. MVC 解决 readonly 问题

    <input type="text" class="form-control" name="UR_UserName" value=&q ...

  10. C#中的readonly与const的比较

    C#中有两种常量类型,分别为readonly(运行时常量)与const(编译时常量),本文将就这两种类型的不同特性进行比较并说明各自的适用场景.工作原理 readonly为运行时常量,程序运行时进行赋 ...

随机推荐

  1. SVM及其对偶

    引自 http://my.oschina.net/wangguolongnk/blog/111349 1. 支持向量机的目的是什么? 对于用于分类的支持向量机来说,给定一个包含正例和反例(正样本点和负 ...

  2. Entity Framewor 学习笔记 (碎碎的东西)

    Proxy 类代理类是为了让EF实现lazy load才需要的 public class BloggingContext : DbContext {     public BloggingContex ...

  3. JavaScript 实现数组的foreach

    Array.prototype.forEach = function (action) { for (var i = 0; i < this.length; i++) { action(this ...

  4. ECMAScript 发展历史

    参考文献:https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Language_Resources

  5. mysql redo log

    mysql> show variables like '%innodb_log_file_size%'; +----------------------+-----------+ | Varia ...

  6. Python中的multiprocessing和threading

    Python中的multiprocessing和threading分别使用来实现多进程编程和多线程编程的.其中threading比较简单,而前者比较繁琐. 下面,我们进行一下分析: 多线程--thre ...

  7. HDU_2037——最多电视节目问题

    Problem Description “今年暑假不AC?” “是的.” “那你干什么呢?” “看世界杯呀,笨蛋!” “@#$%^&*%...”确实如此,世界杯来了,球迷的节日也来了,估计很多 ...

  8. 单网卡多IP导致的socket connect 10060超时错误

    问题: 接管别人代码时遗留的一个bug,在win7下,给一个网卡设置多个ip时,发现无法连接上服务器了.XP下就不会,这多个ip为192.168.1.127,172.1.1.13,10.0.0.1. ...

  9. Nginx各个配置块功能详解

    Nginx学习笔记-入门篇 nginx初探 ginx服务器是轻量级web服务器中广受好评的一款产品,常用功能有HTTP代理与反向代理(目前已支持七层与四层代理),负载均衡,web缓存. nginx配置 ...

  10. DataGrid横向滚动条无法拖动的问题

    项目中经常遇到一些问题,这些问题可能很简单,但是之前从未遇到,可能经过了一番谷歌,也可能是查阅了MSDN,或是借鉴了大牛博客,逐渐有了些眉目,为了将这些东西落地,也为了将来之不易的东西记录下来,以备今 ...