IT. Expert System.

C#

private


The private keyword is a member access modifier. Private access is the least permissive access level. Private members are accessible only within the body of the class or the struct in which they are declared Nested types in the same body can also access those private members. It is a compile-time error to reference a private member outside the class or the struct in which it is declared. For a comparison of private with the other access modifiers

Syntax:
private variable;

private Function()
{
//body
}


Example:

class Employee2
{
    private string name = "FirstName, LastName";
    private double salary = 100.0;

    public string GetName()
    {
        return name;
    }

    public double Salary
    {
        get { return salary; }
    }
}

class PrivateTest
{
    static void Main()
    {
        Employee2 e = new Employee2();

        // The data members are inaccessible (private), so 
        // they can't be accessed like this: 
        //    string n = e.name; 
        //    double s = e.salary; 

        // 'name' is indirectly accessed via method: 
        string n = e.GetName();

        // 'salary' is indirectly accessed via property 
        double s = e.Salary;
    }
}


Content

Android Reference

Java basics

Java Enterprise Edition (EE)

Java Standard Edition (SE)

SQL

HTML

PHP

CSS

Java Script

MYSQL

JQUERY

VBS

REGEX

C

C++

C#

Design patterns

RFC (standard status)

RFC (proposed standard status)

RFC (draft standard status)

RFC (informational status)

RFC (experimental status)

RFC (best current practice status)

RFC (historic status)

RFC (unknown status)

IT dictionary

License.
All information of this service is derived from the free sources and is provided solely in the form of quotations. This service provides information and interfaces solely for the familiarization (not ownership) and under the "as is" condition.
Copyright 2016 © ELTASK.COM. All rights reserved.
Site is optimized for mobile devices.
Downloads: 618 / 158764282. Delta: 0.02649 с