Introduction:
Object-Orientation:
<Access modifier> class <ClassName>
<ClassName> <object name>=new <ClassName>;
Syntax for accessing a class member with the respective of object:
<Object name>.<Class members>
- C# is pronounced as C Sharp.
- C# is a simple, general-purpose, object-oriented programming language.
- C# is a case sensitive language.
- Every statement ends semi colon.
Object-Orientation:
C# is a rich implementation of objected oriented prototype, which includes
Class:
Class is a collection of members.It contain fields, properties, methods, operators, constructors, destructors, events and indexes.
Syntax for Class:
<Access modifier> class <ClassName>
{
//Member(s)
}
Access Modifiers:
Access modifiers/Access specifiers are keywords which are specifying or restricting access level or accessibility of a class or class members.
In C#.NET access modifiers are of five types
- Public
- Private
- Protected
- Internal
- Protected internal
Object:
Object is a instance of a class.which is used to access the class members.
Syntax for Object Creation:
<ClassName> <object name>=new <ClassName>;
Syntax for accessing a class member with the respective of object:
<Object name>.<Class members>
Encapsulation:
Keeping data and member functions into a single unit is called as encapsulation. That mans binding the data and member functions into a class or structure is called as encapsulation.
It can achieve by using Classes and structures.
Abstraction:
Hiding the irrelevant data and member functions from out side classes and project is called as abstraction.
It can achieve by using access modifiers.
Inheritance:
Reusing or redefining the existing class definition is called as inheritance.
.NET supports only single inheritance.
Polymorphism:(One in many forms)
Providing many functionalities to single instance is called as polymorphism.
It can achieve by overloading concepts.
Memory Management:
C# relies on the run time to perform automatic memory management. The CLR has a garbage collector that executes as part of program, reclaiming memory for objects that are no longer referenced. This frees programmers from explicitly deallocating the memory for an object.
No comments:
Post a Comment