Interface Understanding C# with Example



Interface Understanding C# with Example

 	using System;

	namespace CSharpInterface{
		class Class1
		{
			public string Name;
			public int Age;
		}

		class Class2
		{
			public string First;
			public string Last;
			public double PersonsAge;
		}

		class Program
		{
			static void PrintInfo( Class1 item ) {
				Console.WriteLine( "Name: {0}, Age {1}", item.Name, item.Age );
			}

			static void Main() {
				Class1 obj = new Class1() { Name = "Kuldeep Mishra", Age = 31 };
				PrintInfo( obj );
			}
		}
	}
 

0 Comment's

Comment Form

Submit Comment