using System;
public class MyClass
{
private string courseName;
public MyClass( string name )
{
CourseName = name;
}
public string CourseName
{
get
{
return courseName;
}
set
{
courseName = value;
}
}
public void DisplayMessage()
{
Console.WriteLine( CourseName );
}
}
public class MyClassTest
{
public static void Main( string[] args )
{
MyClass gradeBook1 = new MyClass("C#" );
MyClass gradeBook2 = new MyClass("Data Structures" );
Console.WriteLine( "gradeBook1 course name is: {0}",gradeBook1.CourseName );
Console.WriteLine( "gradeBook2 course name is: {0}",gradeBook2.CourseName );
}
}
|