5
Reply

Differentiate bw the public and private ?

    Public can be used everywhere in the application. Private can be access-able only within the scope.

    public can accessible throughout the application private can access only within the class

    .Net has five access SpecifiersPublic -- Accessible outside the class through object reference.Private -- Accessible inside the class only through member functions.Protected -- Just like private but Accessible in derived classes also through member functions.Internal -- Visible inside the assembly. Accessible through objects.Protected Internal -- Visible inside the assembly through objects and in derived classes outside the assembly through member functions.

    private is available only in the defined class where as public is available to entire project

    public : The type or member can be accessed by any other code in the same assembly or another assembly that references it.private : The type or member can only be accessed by code in the same class or struct.