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.]
Blog Archive
-
▼
2010
(24)
-
▼
May
(24)
- C# Coding Standards and Best Programming Practices
- Web Services
- Introduction to XML
- Custom Exceptions
- Exception classes in .NET
- Exception Handling in .NET
- DataSet, DataTable, DataRow
- Create, Read, Update, Delete - ADO.NET sample
- Accessing database using ADO.NET in C# or VB.NET
- Debugging in VS.NET
- Application Configuration Files
- C# sample for retrieving html content from any web...
- C# sample for basic file operations
- Displaying Simple MessageBox
- WinForms
- Namespaces
- Property in C# class
- Classes and Object model in .NET
- DataTypes in C#
- C# Language Syntax
- "Hello World" Application
- Visual Studio .NET
- Introducing the .NET Framework with C#
- .Net Framework
-
▼
May
(24)
Classes and Object model in .NET
Monday, May 3, 2010
Labels:
c# object oriented programming,
Classes and Object model in .NET,
Exception classes in .NET,
using System
Posted by kathir at 9:19 AM
Posted by kathir at 9:19 AM
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment