Summary

   


In this chapter, you have learned about abstraction and encapsulation, two important object-oriented concepts. You have also been presented with a simple C# program and learned about its basic C# elements and general underlying concepts.

The following are the important points covered in this chapter:

Abstraction and encapsulation are important concepts in object-oriented programming.

Abstraction allows programmers, through simplification, to cope with complexity. Only attributes relevant to the problem at hand should be included in an abstraction.

Encapsulation packs data and their associated actions into the class entity. Only relevant parts of an object are exposed to the outside world. This keeps the data inside an object non-corrupted and provides for a simpler interface to the outside world. public and private are two important C# keywords used when implementing the encapsulation concept.

The method of one object can call the method of another object. In OO terminology, we say that a message is sent between two objects.

A class is written in the source code and is an inactive blueprint for its dynamic object counterparts that are created inside the main memory during the execution of a program.

Comments are ignored by the compiler but are used to make the code clearer for the person reading through the source code.

The keywords in C# were chosen by C#'s designers so their names and predefined meaning never change. In contrast, identifiers vary between programs, are decided by the programmer, and are used to name C# constructs, such as classes, methods, and instance variables.

A block forms a logical unit in a program. Among other functions, blocks are used to indicate which parts of a program belong to which classes and methods.

Every program must have one Main method. The Main method is called by the .NET runtime and is the first part of a program to be executed.

A variable has a name (identifier), is of a specific type, and represents a memory location containing a value.

A variable of type string can be used to store text.

Any set of actions performed by C# can be broken down into simple instructions called statements.

The predefined functionality in the .NET Framework class library can be conveniently accessed from the C# source code.

Methods are defined inside classes and contain statements. When a method is called, its statements are executed in the same sequence as they are written in the source code.

The equals sign is used in two different fashions, as an assignment operator (=) and as an equality operator (==).

The if statement is able to change the program's flow of execution. The path followed depends on the Boolean value of its condition.

To make the C# source code clear for the reader, follow a certain format and style.

The .NET Framework class library has comprehensive documentation attached.

Three common statements found in C# are declaration statements, assignment statements, and method call statements.


   


C# Primer Plus
C Primer Plus (5th Edition)
ISBN: 0672326965
EAN: 2147483647
Year: 2000
Pages: 286
Authors: Stephen Prata

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net