C# > Introduction

Object Orientation in C#

Object orientation of C#


C# is a rich implementation of the object-orientation program, which includes encapsulation, inheritance, and polymorphism. Encapsulation means creating a boundary around an object to separate its external behavior from its internal implantation details. The distinctive features of c# from an object oriented perspective are:

Features of C# based on Object Oriented are:

Unified type system:

The fundamental building  block in c# is an encapsulated unit of data and functions called type. C# has a unified type system, where all types share a common base type this menas that all types, whether they represent business objects orprimitive types such as numbers share the same basic set of functionality. For example, an instance of any type can be converted to a string by calling its Tostring method.

Classes and interfaces:

The only kind of a type is class, In c# there are several kinds of types one of which is an interface, an interface is like a class, which describes it members. The implementation for those members comes from types that implement from interface, Interface are particularly used in scenarios where multiple inheritance is required unlike languages such as ( C++, Eiffel).

Properties: 

 A property is a member that provides mechanism to read and write the value of private field, properties can be used as public data members but they are special methods called accessors, this enables the data to be accessed easily and still helps to promote safety and flexibilty of methods.

Methods:

A method is a group of statements that together perform the task. Every c# program has at least one class with a method named Main. If we use the method we need to define the method and call the method.

Events:   

Events are a way to provide notifications to the clients of that class when some interesting thing happens to an object. The most familiar thing is in graphical user interfaces typicaly the classes that represent controls in the interface have events that are notified when the user do something to the control, For example ( click a button. )

 Views: 6088 | Post Order: 2



Write for us






Hosting Recommendations