Select category to view:

  • Cast

    Cast – Converting a variable to a different type in an operation (int*)

    Although necessary at times, casts are inherently dangerous (becuase you don’t get a compiler warning that a potentially bad conversion will occur). It is more nomral to just allow C++ to do its normal automatic conversion which will typially involve increasing the size of everything to match the largest variable, and then downsizing if necessary to fit the result in the destination variable. However there are times when you’ll want to specify a conversion.

    (more…)

    Const

    
    	const int BUF_SIZE = 512;
    	static const int BUF_SIZE = 512;	//Static is needed when defining at class level
    

    (more…)

    enum (Enumeration)

    Using Enum

    	enum name {enumeration list} optional varaible(s);

    (more…)

    Typedef

    A typedef lets you use a synonym (another name) for a type. E.g.

    
    	typedef double wages;
    	typedef int exam_score;
    	typedef wages salary;
    

    Unions

    Nope, you can’t use them in managed C++ as they are not safe.

    Variables

    C++/CLI being a .Net language it has its basic types directly mapping to that provided by the .Net framework. The structure below shows the various basic types of C++/CLI and the types they map to in the .Net framework. (more…)