Changes

Jump to: navigation, search

OPS435 Python Lab 7

1,534 bytes added, 10:59, 3 December 2017
INVESTIGATION 1:
|}
= INVESTIGATION 1: Classes and objects = In the last lab we created a '''class''' named Student and a couple of '''objects''' of type Student which were named student1 and student2. Let's spend some more time on that distinction. A class is a type, a description of a thing, the definition of what it should look like. An object is an instance of a class, an individual described by a class, a specific thing with properties defined by a class. Here are some examples of what might be types and what might be objects of those types: {| class="wikitable" | style="margin-left:20px;"|- style="font-weight:bold;"| Class | Objects of that class|- style="background-color:white;border:none;"| IPAddress| 192.168.1.3, 192.168.1.10, 10.0.0.50, 142.204.1.2|- style="background-color:asdwhite;border:none;"| Person| Andrew Oatley-Willis, Murray Saul, Andrew Smith|- style="background-color:white;border:none;"| BMWModel| BMW2Series, BMW3Series, BMW4Series, BMWXSeries, BMWMSeries, BMWiSeries|- style="background-color:white;border:none;"| Car| Andrew's silver Civic with VIN 1234567890, John's blue Subaru with VIN 0987654321, Evan's BWMMSeries with VIN 4567981230|} The exact definition of the type and what you would expect to store in objects of that type is up to you - the programmer. You want to design your classes so that you can manage data in your application as easily as possible. Note that inside a program typically a class name starts with a capital letter and object names, as typical variable names, start with a lowercase letter.
= LAB 7 SIGN-OFF (SHOW INSTRUCTOR) =

Navigation menu