Technology Guruu

  • Home
  • Site Info
    • About Us
    • Disclaimer
    • Privacy Polacy
  • Home
  • Digital Marketing
    • SEO
    • SMM
    • SEM
  • Quotes
  • Technical
  • Java
  • .Net
    • C#.Net
    • ASP.Net
  • Keychains

Friday, 28 October 2016

How Many Members Know About Access Modifiers Completely

 Akansha     12:30:00     C#.Net, Java, TechnicalQuestions     No comments   

Friends Today MY Topic is Access Modifiers.This Topic Is Heart For Any Programming Language because every developer first know the usage of public,private,protected,internal,protected internal i simply say you know the access modifiers.The Access Modifiers are Common in All programming languages like c#.net,java,vb.net etc but small difference in usage.So,first we learn the C#.Net access Modifiers i place the best description for you.

Access Modifiers in C#.NET And Java

Java Access Modifiers
All Access Modifiers
  •  Access Modifiers are public,private,protected,internal and protected internal.This access Modifiers are very important and precious topic because when we place public  and where we place public and what has done place the public within assembly and what happening place place the public in outside the assembly.This types of queries are occur for every access modifiers .
  •  Access Modifiers topic very easy to understand and in this each modifier when its work like its work in inheritance,interface,abstract etc.
                           *************Introduction**************

Introduction

   Access modifiers or Access specifiers are keywords which are specifying the accessability or access level of class members.
While defining a class or while declaring a class member we can define the accessibility with the help of access modifier.
In C#.Net we have 5 access modifiers. They are
1.Public
2.Private
3.Protected
4.Internal
5.Protected Internal
                                                    *************Public**************                    

1.Public

              If we declare a class or class member as public which can be accessed by all the classes of current project and all the projects of application.
To access a public member there is no restriction with in the application
Ex:-class class1
{
public int a=10;
public void method1()
{
Console.WriteLine("method1 value is:"+a);
}
}
class class2
{
 public void method2()
{
class1 obj=new class1();
Console.WriteLine("method2 value is:"+obj.a);
}
}
class Program
{
static void Main(String[] args)
{
class1 obj1=new class1();
Console.WriteLine("main method value is:"+obj1.a);
obj1.method();
class2 obj2=new class2();
obj2.method();
Console.ReadLine();
}
}
                                  *************Private**************

2.Private               

                     If we declare a class or class member as private, which can be accessed only with in that class.
Ex:-class class1
{
private int a=10;
public void method1()
{
Console.WriteLine("method1 value is:"+a);
}
}
class Program
{
static void Main(String[] args)
{
class1 obj1=new class1();
obj1.method1();
Console.ReadLine();
}
}
                                      *************Protected**************

3.Protected

               If we declare a class or class member as protected which can be accessed by current class members as well as derived class members.
Protected is depending on inheritance concept.
Ex:-class class1
{
protected int a=10;
public void method1()
{
Console.WriteLine("method1 value is:"+a);
}
}
class class2:class1
{
public void method2()
{
Console.WriteLine("method1 value is:"+a)
}
}
class Program
{
static void Main()
{
class2 obj=new class2();
obj.method2();
obj.method1();
Console.ReadLine();
}
}

                                       *************Internal**************

4.Internal

            If we declare a class or class member as internal which can be accessed by all the classes of current project.
Ex:-class class1
{
internal int a=10;
public void method1()
{
Console.WriteLine("method1 value is:"+a);
}
}
class class2
{
 public void method2()
{
class1 obj=new class1();
Console.WriteLine("method2 value is:"+obj.a);
}
}
class Program
{
static void Main(String[] args)
{
class1 obj1=new class1();
Console.WriteLine("main method value is:"+obj1.a);
obj1.method1();
class2 obj2=new class2();
obj2.method2();
Console.ReadLine();
}
}
Share With Your Friends in Social Media (Facebook, Twitter, Google Plus Etc...) if You Like Our Content And Feel Free To Comment.
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg
Email ThisBlogThis!Share to XShare to Facebook
Newer Post Older Post Home

0 comments:

Post a Comment

Popular Posts

  • Missing My Friend Quotes : Friendship Day Quotes 2017
    Friends today my article about missing friends and moments with them. Here you are seen the best friendship quotes and some  feelings when...
  • Love Failure Quotes and Sad valentines day Quotes
    We Love Someone is a easy process sometime takes long time to love someone love others within short period but anyway always love dependin...
  • Brief description about Delegates
    Introduction about delegates and why delegates are came the main purpose of delegates how to useful and what are the advantages and disadv...
  • Na Tanu Samjhawan Ki Song lyrics
    Na Tanu Samjhawan Ki Song Lyrics With English Translation Movie : Humpty Sharma ki Dulhaniya Song : Samjhawan Song Singer : Arijit ...
  • Detail Introduction about C#.Net
    Brief Introduction about C#.Net  Introduction C#.Net is the one of the Programming Language the .Net Framework also contains ano...
  • Top 10 valentine's day Quotes and Greetings wishes
    All Lovers have Anxiety in Valentines day because it is a festival to all lovers in these they enjoy a lot and celebrate the Valentine...
  • Wonderful sayings about Life.
    I Believe Follow  Things(Life Quotes) I Believe I believe: ********** Believe in Life ********** That we don't have to chan...
  • Best Good Afternoon wishes greetings and quotes
    Top Most Good Afternoon Wishes Good Afternoon wishes are gives a relaxation in afternoon time.This wishing can be done between 12 to 3 p...
  • Letter B wallpapers and keychains for facebook
    In these we are Providing Letter B Wallpapers and awesome Key chains also Some Facebook Profile Pictures and cover photos also we are prov...
  • Brief Description about Multicast Delegate
    Multicast delegate is an extension of normal delegate. It helps you to point more than one method at a single moment of time. Multicast ...

Categories

  • Entertainment (67)
  • TechnicalQuestions (58)
  • Quotes (11)
  • C#.Net (8)
  • Java (8)
  • ValentinesDay (4)
  • SEO (3)
  • Home
  • About Us
  • Disclaimer
  • Privacy Policy
  • Sitemap

Copyright © 2015-2017 Good Friends 5.All Rights Reserved• And Our Sitemap • All Logos and Trademark Belongs To Their Respective Owners•