Converting Types

  Convert::To Single MySingle = Convert::ToSingle(SomeString); Internationalization – IMPORTANT!!! When converting from strings remember to deal with possible Internationalization issues for countries which use different characters, for instance like commas instead of decimal points – Convert::To doesn’t deal with this! See here  

Read More

enum (Enumeration)

Using Enum enum name {enumeration list} optional varaible(s); Examples enum colour_type {red, green, blue} colour; //The variable colour can only be assigned the values red, green or blue (red = 0, green = 1, blue = 2 will be done by the compiler – these are basically const values) enum colour_type {red, green = 9, […]

Read More

Const

const int BUF_SIZE = 512; static const int BUF_SIZE = 512; //Static is needed when defining at class level #define may also be used, e.g.:- #define VIDEO_LOG_PATH “C:\\Video_Log_Archive” const objects are local to a file by default Unlike other variables, const variables declared at global scope are local to the file in which the object […]

Read 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;

Read More

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 […]

Read More

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. C++/CLI (use to declare) .Net / CLI Type Declaration Description bool Boolean bool isValid = true; […]

Read More