Wednesday, March 12, 2008

OOPS & C#

OOP & C#
The skeleton of object - oriented programming is of course the concepts of class. This C# tutorial
on OOPS explains classes and their importance in implementation of object ? oriented principles.
Any language can be called object ? oriented if it has data and method that use data encapsulated in items named objects. An object ? oriented programming method has many advantages, some of them are flexibility and code reusability.
All the programming languages
supporting Object oriented Programming will be supporting these three main concepts:
Encapsulation
Inheritance
Polymorphism
Encapsulation in C#:
Encapsulation is process of keeping data and methods together inside objects. In this way
developer must define some methods of object?s interaction. In C# , encapsulation is realized through the classes. A Class can contain data structures and methods. Consider the following class.
public class Aperture{
public Aperture(){}protected double height;protected double width;protected double thickness;public double GetVolume(){
double volume = height*width*thickness;if(volume<0)return isoutside =" true;" ap =" new">you need to run .NET console and run the next command: csc filename.cs .

No comments: