This week’s workshop is available at http://devsoc.co.uk/wp-content/uploads/2011/12/ShapeInheritance-fixed.zip. I’ve included a bunch of comments to explain what each part does and also included an example of a second level of inheritance, inheriting the Rectangle from the Square, which inherits from the Shape.
To test if you understand the concepts behind this, try creating your own C# project and creating an abstract Person class to store Name and Age, and then create Staff and Student classes that inherit from the Person class. The Staff class should store data about their office and module that they teach, the student class should have a course that they are enrolled on and a grade for first year.
Next week we will be introducing Lists to store collections of data, Getters and Setters and overriding methods from the C# base object class to make outputting data about an object easier. Don’t worry if this sounds confusing, it’ll make sense by the end of the workshop!