Cybercrux

Everything is achievable through technology

Practical use of Interface

1. We can inherit multiple number of interfaces

example

A. create a interface

public interface Target
{

string UserName { set; }

}

C.Define How may as Required

public class TargetDefinition : Target
{
public string UserName { private get; set; }
}

B. Inherit where that needed

public class Connector : Target, Another
{

}

C. Use When u need that
private Target target = null;
//in Constructors
this.target = new TargetDefinition();
//TargetDefinition or which definition needed

Summary,

With the same object we can call any definition that we provided

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s