IT SOLUTIONS
Your full service technology partner! 
-Collapse +Expand
To/From Code
-Collapse +Expand Cross Ref Guide
-Collapse +Expand Members-Only
Sign in to see member-only pages.
   ► KBTo/From GuidesC++/CLIOOP Basics  Print This     

Variables (Cross Ref > OOP Basics)

By Mike Prestwood

C++/CLI versus Delphi Prism: A side by side comparison between C++/CLI and Delphi Prism.

 
Language Basics
 

Language basics is kind of a catch all for absolute beginner stuff. The items (common names) I chose for language basics is a bit random and include items like case sensitivity, commenting, declaring variables, etc.

Variables

[Other Languages] 

Languages Focus

A variable holds a value that you can use and change throughout your code so long as the variable is within scope. With variable declaration, you not only want to know the syntax of how you declare a variable but you also want to know where. Are you allowed to declare a variable inline? What are the available scopes: local vs. global. Can you assign a value at the same time you declare a variable?

C++/CLI: 
Delphi Prism:   var x: Integer := 0;

Prism supports type inference where you just use a variable and the compiler will then choose the lowest type possible (such as an Integer before a LongInt). With Prism, you frequently do not have to use commands to convert from one type to another.

Variable names are not case sensitive. The Prism language offers both old-style declaring variables before the begin as well as in-line variable declaration.

Prism does support variable initialization too.

Prism offers many variable types. Some common variable types include Integer, LongInt, Single, Double, Boolean, and String.

Syntax Example:  
var
FName: String; //This is old-style.
begin
FName := "Mike Prestwood";
MessageBox.Show(FName);

Var Age: LongInt; //Local variables.
Age:=36;
MessageBox.Show(Fname + " is " + Age + " years old");

//Assign values too...
Var Wife: String:="Lisa"; Var WifeAge: Integer:=32;
messagebox.Show(wife + " is " + Wifeage + ".");
end;












Go ahead!   Use Us! Call: 916-726-5675  Or visit our new sales site: 
www.prestwood.com


©1995-2024 Prestwood IT Solutions.   [Security & Privacy]