Horje
interface property implementation c# Code Example
interface property implementation c#
using System;
interface IName
{
    string Name { get; set; }
}

class Employee : IName
{
    public string Name { get; set; }
}

class Company : IName
{
    private string _company { get; set; }
    public string Name
    {
        get
        {
            return _company;
        }
        set
        {
            _company = value;
        }   
    }
}

class Client
{
    static void Main(string[] args)
    {
        IName e = new Employee();
        e.Name = "Tim Bridges";

        IName c = new Company();
        c.Name = "Inforsoft";

        Console.WriteLine("{0} from {1}.", e.Name, c.Name);
        Console.ReadKey();
    }
}
/*output:
 Tim Bridges from Inforsoft.
 */




Csharp

Related
c# environment variables Code Example c# environment variables Code Example
decrease image size C# Code Example decrease image size C# Code Example
c# get list of all class fields Code Example c# get list of all class fields Code Example
how to disable click listener in android Code Example how to disable click listener in android Code Example
c# callback param Code Example c# callback param Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
13