static public void Main()
    {
        DemoEncap obj = new DemoEncap();

        obj.Name = "Aayushi";
        obj.Age  = 23;
        Console.WriteLine("Name: " + obj.Name);
        Console.WriteLine("Age: " + obj.Age);
    }
예제 #2
0
파일: Program.cs 프로젝트: havishat/CSharp
        static void Main(string[] args)
        {
            DemoEncap obj = new DemoEncap();

            obj.Name = "Ankita";

            obj.Age = 21;

            Console.WriteLine("Hello World!");
            Console.WriteLine("Name:" + obj.Name);
            Console.WriteLine("Age:" + obj.Age);
        }
예제 #3
0
    // Main Method
    static public void Main()
    {
        // creating object
        DemoEncap obj = new DemoEncap();

        // calls set accessor of the property Name,
        // and pass "Ankita" as value of the
        // standard field 'value'
        obj.Name = "Ankita";
        // calls set accessor of the property Age,
        // and pass "21" as value of the
        // standard field 'value'
        obj.Age = 21;
        // Displaying values of the variables
        Console.WriteLine("Name: " + obj.Name);
        Console.WriteLine("Age: " + obj.Age);
    }