C# Tutorial - Summary


By now you should be comfortable with what an object is and what a simple object looks like. Below is a summary of some of the concepts covered in this section.

  • C# is an object oriented programming language (oop).

  • Data and the procedures that act upon the data are encapsulated into a single object.

  • An object is a tangible item, something that can be seen, touched or felt, or something that can be eluded to, conceptualised, thought about.

  • Each object must have a unique identity.

  • An object has an interface that can be seen by other objects.

  • An object can be diagrammed using UML.

  • A class is an abstract representation for some particular type of object.

  • A class contains attributes (information) and methods (behaviour) that act upon the attributes.

  • Methods are functions that manipulate the data associated with an object or perform some other operation relevant to the object. A method can be thought of as a named sequence of statements.

  • A constructor is a method that is invoked upon instantiation of a class.

  • Each class can have more than one constructor, allowing the class to be built taking different information.

  • A copy constructor is used to take a copy of another object of the same type.

  • A single class can be split across several files through the use of the keyword partial.

  • When using variable within a control structure, the variable only has scope with the curly brackets that it is declared between.

  • Encapsulation is a way of binding information and the behaviour performed upon the information together in a single object.

  • Data hiding is simply the means to remove direct access to an object's information, by providing operations that perform actions on the data.

  • Inheritance represents the relationship between two objects A and B, such that B 'is a kind of' A. This can be diagrammed using UML.

  • The class inherited from is called the 'base' class.

  • Polymorphism allows derived classes to take on many forms of the base class.

  • An access-modifier determines what can be seen by another part of the program.

  • Properties allow users to access class variables as if they were accessing member fields directly, while actually implementing that access through a class method.

  • Aggregation is an association between two objects such that 'object B is a part of object A', but object can also be its own object.

  • Composition is Aggregation but the object B can only exist in object A.

Glossary of Terms

Term Description
Abstraction The process of establishing the decomposition of a problem into simpler and more understood primitives.
Access Methods Methods that give access to attributes of an object.
Access Modifier Control the extent to which the class or part of is available to other classes.
Aggregation An association between two objects such that 'object B is a part of object A', but object can also be its own object.
Attribute A piece of data held by a class.
Class An abstract representation for a particular type of object.
Composition An association between two objects such that 'object B is a part of object A', but object B can only exist in object A.
Constructor A method invoked upon instantiation of a class. Memory for the class is allocated at this time.
Data Hiding A method of removing direct access to an object's information.
Destructor A method used to clean up an object when it is finished with.
Encapsulation A way of binding information and the behaviour perform upon the information together in a single object.
Inheritance The relationship between two objects A and B, such that B 'is a kind of' A.
Interface The part of an object that can be seen by other objects.
Method A function to manipulate the attributes of a class.
Object A software construct encapsulating attributes and methods.
Object-oriented programming A type of programming in which programmers define not only the data type of a data structure, but also the types of operations (methods) that can be applied to the data structure.
Polymorphism The ability to appear in many forms.
Properties Allow users to access class variables as if they were accessing member fields directly, while actually implementing that access through a class method.
Scope A variables area of existence.
UML Unified Modelling Language (see www.UML.org)

Objectives

  1. Suggest candidate objects for use in a software program from a requirement.

  2. Describe the relationship between an object and a class.

  3. Learn the structures of a class, attributes and methods.

  4. Understand the concepts of Encapsulation, Data-hiding, Inheritance and polymorphism.

  5. Be able to decide which access modifier to give each member of an object.

  6. Recognise properties used in code.

  7. Understand when to use Aggregation and when to use Composition.


<< Previous Contents Next >>

© Publicjoe, 2008