Friday, December 27, 2013

C# - Tutorial for Beginners - Part 3

with 0 Comment
C# - Beginners Tutorial – 3
Access Specifiers and Characterstics of OOPS

Access Specifiers (in C Sharp) :
  • Access specifiers or Visibility mode is used to discuss about the scope of the variables and functions used inside a class .
  • Access specifiers are mainly used to increase the protection level for the particular Methods or variables used in the class.
  • Access specifiers may be used for implementing the concept of Encapsulation and Abstraction(Which was discussed in the previous tutorial).
  • 5 Major types of Access specifiers are discussed below :
  1.  Public
  2.  Private
  3.  Protected
  4.  Internal
  5.  Protected internal
PUBLIC :
  • Public access specifier allows a class to share its members and functions with other classes. It may be within or outside the application.
  • Any member declared as public can be accessed anywhere in the class.
PRIVATE:
  • Private access specifier allows a class to share its members and functions only within the same class.
  • Members and Methods declared in one class cannot be accessed from outside the class.
  • When a method is declared private , even the instance of that class cannot access it .
PROTECTED:
  • Protected access specifiers provides access only for the derived class to access its member variables and functions within the application.
  • Protected member variables and functions cannot be accessed from outside the class.
INTERNAL:
  • The default access specifier is Internal.
  • A member variable or function declared internal can be accessed by any of the class or method within the application..
  • Internal members cannot be accessed from the classes outside the Application.
PROTECTED INTERNAL:
  • Protected Internal access specifier allows a class to expose its member variables and functions to the class containing it , its child class , any other classes within the application.

  • They are not applicable to the classes outside the application.
These Access specifiers will be explained with the example using C Sharp in the next tutorial, so that you can get a clear idea about how and where to use the access specifiers.

CHARACTERSTICS OF OBJECT ORIENTED APPROACH :

1)    Realistic Modeling :

  • Everything we use in our programs are objects . Real world objects are also present . These objects may contain its own attributes and behaviours. These attributes and behaviours depict how the object acts and reacts.


2)    Reusability :

  • This characterstics depicts that the Member variables and methods used in a class can be reused. The existing methods and functions can be used anywhere in an application.This feature of reusability makes Object oriented approach a more standard and efficient one.


3)    Flexibility to Change :

  • In an existing system , when a change is to be brought, the existing system need not be completely destroyed. Enhancement of some new features in the existing system makes it as a new system. New features can be easily added in the existing system to bring a new product. Thus OOPS provides you a flexibility in efficient change of the System.
  • In the upcoming tutorials we will just move on to the Introduction to Compilers , how does it works and Syntax for declaring variables processing operations in C Sharp and Various Programs will be updated for your reference . Kindly Make use of it .


LETS MAKE IT EASYwww.indiaengineer.net


0 comments:

Post a Comment

Powered by Blogger.

Blog Archive