Datasheet
Setup
x
5
programming techniques available to the developer using off-the-shelf tools and technology, but as
the problems surmount, so will the desire to change those tools into something more, something that
demonstrates the need for a new approach to programming beyond the traditional object-oriented one,
and a new language to explore and expose those concepts more succinctly and directly.
SETUP
Imagine a system, a simple one (to start) for tracking students and instructors and the classes they
teach. In keeping with traditional object-oriented thought, several domain types are defi ned, here
in C# 2.0, though the actual language — C#, Visual Basic, C++/CLI (any .NET language would
work) — in which they are defi ned makes little difference:
class Person
{
private string m_first;
private string m_last;
private int m_age;
public Person(string fn, string ln, int a)
{
FirstName = fn;
LastName = ln;
Age = a;
}
public string FirstName
{
get { return m_first; }
set { m_first = value; }
}
public string LastName
{
get { return m_last; }
set { m_last = value; }
}
public int Age
{
get { return m_age; }
set { m_age = value; }
}
}
class Student : Person
{
private string m_major;
public Student(string fn, string ln, int a, string maj)
: base(fn, ln, a)
{
Major = maj;
}
public string Major
c01.indd 5c01.indd 5 10/1/2010 3:20:36 PM10/1/2010 3:20:36 PM