C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Interview   Jobs   Projects   Offshore Development    
Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Revenue Sharing | Talk to Us |



My Profile

Gifts

Active Members
TodayLast 7 Days more...








Classes and Object model in .NET



Classes and Object model in .NET







We will start with an introduction to what is object oriented programming, how to write simple classes, creating objects etc.

What is a 'class' ?

In modern object oriented programming, large computer programs are divided into several 'classes'. Typically, a large project will have several hundred classes. A class represents an entity in a program. For example, if you are doing a small program called calculator, you will typically have a single (or more) class called 'Calculator' (you can give any name for your class). The class will have several 'methods', that will do the functionality of the class.

So, your calculator may have methods like the following:
Add()
Subtract()
Multiply()
Divide()

Here is a sample calculator class, written in C# :


using System;

public class Calculator
{
public int Add(int value1, int value2)
{
return value1 + value2;
}

public int Subtract(int value1, int value2)
{
return value1 - value2;
}

public int Multiply(int value1, int value2)
{
return value1 * value2;
}

public int Divide(int value1, int value2)
{
return value1 / value2;
}
}



Classes and objects

[To be added.]

Object model in .NET

[To be added.]








Next Chapter: Property in C# class


Previous Chapter: DataTypes in C#


Tutorial Index




Read TATA Nano reviews.
dotNet Slackers   BizTalk Adaptors    Web Design   Scripts
Are you waiting for engineering entrance result? Watch here for engineering entrance results.
it help desk

Contact Us    Privacy Policy    Terms Of Use