Well, this is what i came up with after reading lessons about C# class inheritance.Code:using System; namespace myProgram { class Student { public static int NumberOfStudents; private int Id; private string Name; private string Type; public Student(int id, string name, string type) { this.Id = id; this.Name = name; this.Type = type; NumberOfStudents++; } ~ Student() { Console.WriteLine("Student Terminated."); NumberOfStudents--; } } class SchoolStudent : Student { public SchoolStudent(int id, string name) : base(id, name, "School") { } } class myProgram { static void Main() { SchoolStudent [] students = new SchoolStudent[15]; students[0] = new SchoolStudent(1, "Jack"); students[1] = new SchoolStudent(2, "Jack"); students[2] = new SchoolStudent(3, "Jack"); students[3] = new SchoolStudent(4, "Jack"); Console.WriteLine("There are currently "+Student.NumberOfStudents+" students."); } } }
Maybe you veterans could help me making this code better...