Feeds:
Posts
Comments

Archive for May, 2006

An interface in C# is a type just like class is a type.  The difference between interface and class is that an interface only contains the method headers (no implementation of methods and no attributes) where as a class contains both attributes, methods and method implementations.
Example
public interface IBankAcccount
{
    double AccountBalance();
    bool  IsActive();
}
Note that we havent [...]

Read Full Post »

What is an Abstract Class?

We usually think of classes as being complete definitions.  However, there are situations where complete definitions of a class is not possible.  In OO, we can create a class that have incomplete definitions ( we can define what methods should be there in the class, but not the definition of the method).  These  incompletly defined classes [...]

Read Full Post »

Polymorphism refers to the ability of two or more objects belonging to different classes to resepond exactly to the same message in class specific ways.
Note : If you search the web for polymorphism, you will find many many definitions. I even read somewhere that overloading is also a kind of polymorphism.  But  a majority of the [...]

Read Full Post »

What are Collections?

A collection object is an object that can hold multiple references of some other type of objects. Different collections in OO  

Array -  In C# arrays are objects.
Ordered lists  – similar to array. elements placed in a particular order and retrieved in same order
SortedList  – similar to ordered list. The elements are sorted when added to [...]

Read Full Post »

Inheritance is the process of creating a new class from one or more existing class.  In otherwords, a new class acquires the qualities of existing class.
Example.  Lets say that we need to model a bank account.  Lets say that the bank has only two types of account  – Savings Account and Current Account.  Both of [...]

Read Full Post »

Are programmers blind?

This  is one of the stories which every one knows.  Once a couple of blind men,  in-order to understand an Elephant, went to a zoo.  Each went and touched the Elephant and got a feel of it.  They went back home and started to write about Elephant in their own experience.  The blind man who [...]

Read Full Post »

Association is the relationship between two classes. When the association is between two classes, its called Binary Association.  When the association is between two instances of the same class, then its called  reflexive or unary association.
Example : Binary Association :  Employee works for Employee
                Unary Association: A Employee supervises Employees
For a given association between object A [...]

Read Full Post »

Instance Constructor is a speical type of  method in a class which have the same name as a class that gets executed when a new instance (object) of a class is creaetd.
Student s = new Student();
In the above line, C# compiler actually calls the constructor of Student class to create an instance.  The constructor allocates [...]

Read Full Post »

As discussed in the previous posts, attributes are the information we gather about an object.   In real time projects,  we often restrict the access to these attributes for variety of reasons. One such reasons is data security ( we are not going to get into details of this).   These kinds of restrictions are called as Information [...]

Read Full Post »

In order to make use of the service provided by an object, one should know what object is capable of performing and how to request for the service.   Lets say an Object A wanted to use the service of Object B, then Object A should know what service(s) Object B provides and also should talk in [...]

Read Full Post »

Older Posts »