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. [翻译]localStorage性能的好坏

    原文地址:Is localStorage performance a problem? 如果说2012年对于web开发世界来说有什么值得记住的事的话,关于localStorage性能的争论一定高居榜首 ...

  2. android百度定位

    package com.aihunqin.test; import android.app.Activity; import android.os.Bundle; import android.wid ...

  3. clone database and rename

    使用 management studio right click database -> Tasks -> Generate Scripts -> next until " ...

  4. ViewConfiguration滑动参数设置类

    /** * 包含了方法和标准的常量用来设置UI的超时.大小和距离 */ public class ViewConfiguration { // 设定水平滚动条的宽度和垂直滚动条的高度,单位是像素px ...

  5. PERL DBI 自动重连问题

    [root@wx03 mojo]# cat relink.pl use Mojolicious::Lite; use JSON qw/encode_json decode_json/; use Enc ...

  6. COJ 0034 动态的数字三角形

    题解:简单dp吧. 自顶向下的写法: #include<iostream> #include<cstdio> #include<cmath> #include< ...

  7. samba服务器的搭建及使用

    一.Samba服务器的安装及配置 1.samba服务器的安装 rpm –ivh /mnt/Packages/samba-3. 5. 10-125. el6.i686.rpm 需要挂载红帽6的光盘 2. ...

  8. HDU_2050——折线分割平面问题,递推

    Problem Description 我们看到过很多直线分割平面的题目,今天的这个题目稍微有些变化,我们要求的是n条折线分割平面的最大数目.比如,一条折线可以将平面分成两部分,两条折线最多可以将平面 ...

  9. [LeetCode] 110. Balanced Binary Tree 解题思路

    Given a binary tree, determine if it is height-balanced. For this problem, a height-balanced binary ...

  10. Mac OS X Shell 脚本和终端命令

    系统 重启 Mac OS X: 1 shutdown - r now 关闭 Mac OS X: 1 shutdown now 电源管理/省电 获取当前电源管理设置的信息 1 pmset -g 设置显示 ...