(2013 by Dr. Liping Liu
Week 2:
Lecture 1: Three Different Class and Objects
Real world objects ( Conceptual objects ( Programming Objects
Real World Classes ( Conceptual classes ( Programming classes
[pic] These are real world objects, and their groups are real world classes.
Model objects are the representation of real world objects using symbols, and the groups of the same kind is a conceptual class. In UML, here is an example of a conceptual class
[pic]
Real world objects may be related and these relationships are also modeled as conceptual relationships among conceptual objects. For example, the following diagram shows that both students and professors are special kinds of users.
[pic]
For another example, the following diagram shows that employees are associated with other employees through supervising relationship and RegistrationForm objects needs to know RegistrationManager objects.
[pic]
UML stands for Unified Modeling Language. Here is how it came from:
[pic]
Programming objects are merely memory blocks that hold both data and functions. They are all created by some templates, which are programming classes.
Person objJohn = new Person(“John”, “12/23/1987”, “Male”);
Person objLisa = new Person(“Lisa”, “1/2/1990”, “Female”);
Lecture 2: Super and sub classes connected by inheritance relations i. Reason 1: there is already a class that has some methods you want to use but does not fit your needs exactly ii. Reason 2: There is a need to deal with a large number of objects that are similar overall but have some differences.
Lecture 3: Using Protected and Virtual keywords: iii. Protected: mark a variable, method, or property that can be accessible to children but not to outsiders iv. Virtual: mark a method that can be overridden by children classes
Example 1: Create the employee with three data members: name, job, salary, and hire date, and a