3.5. User-Defined Types and Reference Variables

In a non-OO programming language such as C, the following statement is a declaration that variable x is an int(eger), one of several simple, predefined types defined to be part of the C language:

int x;

What does this really mean? It means the following:

  • x is a symbolic name that represents a location in memory that stores an integer value.

  • The "thing" that we named x understands how to respond to a number of different operations, such as addition (+), subtraction (-), multiplication (*), division (/), logical comparisons (>, <, =), and so on that have been defined for the int type.

  • Whenever we want to operate on this particular integer value in our program, we refer to it via its symbolic name ...

Get Beginning C# 2008 Objects: From Concept to Code now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.