Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I would say:</p> <ul> <li><p><strong>Namespace</strong>: A category or brand of cars. Note that the brand really doesn't have to dictate how the car is built. You can't say a Honda always have four doors, or that it always has 4wd. Such specifics is up to the class to dictate. <a href="https://stackoverflow.com/questions/819793/namespaces-then-classes-then-methods-is-there-a-metaphor/819813#819813">Rich.Carpenter's post</a> explains the purpose of namespaces very well.</p></li> <li><p><strong>Class</strong>: Blueprint for how to build a specific car.</p></li> <li><p><strong>Object</strong>: An actual car (instance) created from the car blueprint (the class)</p></li> <li><p><strong>Method</strong>: Something a user of the car can make it do. <code>Start()</code>, <code>IncreaseThrottle()</code>, <code>Brake()</code>, <code>OpenDoor()</code>, etc.</p></li> <li><p><strong>Property</strong>: Attributes, information and building blocks which the car contains. E.g. Total running miles, color, steering wheel dimension, stereo system etc etc.</p></li> </ul> <p>Some concepts which could seem more advanced to you. Maybe overkill right now, but read it if you're interested:</p> <ul> <li><p><strong>Inheritance</strong>: When a class is based on another class and adds some more specific details. A line of inheritance usually goes from the most common and general aspect, all the way down to a point where it makes no more sense to be more specific. Example of this in the context of animals: <em>Animal->Mamal->Rodent->Rat->RattusNorvegicus</em></p></li> <li><p><strong>Aggregates</strong>: Properties that "builds" the object. E.g. "This car is an aggregation of four wheels, a chassis, an engine, etc".</p></li> <li><p><strong>Attribute</strong>: Properties that describe the object, usually not part of its physical construction. E.g. Color, top speed, engine volume etc. </p></li> <li><p><strong>Encapsulation</strong>: The concept of concealing certain properties from the user, or to protect certain properties from being used incorrectly (and thereby damaging the object). E.g. You don't expose the gear-property of a car class to be altered freely. You encapsulate it and make sure <code>Clutch()</code> is called before <code>SetGear()</code>.</p></li> <li><p><strong>Overriding</strong>: If a class inherits from another class, it also inherits methods from that class. Overriding is basically when the <em>inheriting</em> class replaces the implementation of such a method with its own required behaviour. Example of usage in next point.</p></li> <li><p><strong>Polymorphism</strong>: A difficult concept to grasp until you start using it practically. It means referring to a very specific kind of object, by using a generic reference which allows you to ignore the specific type (when you don't need to know it). E.g. If you want to "read" the license plate number property of every vehicle in a parking lot, you don't really care what the brand is, or even if it's a trailer or motorcycle or whatever. To be able to do this, we make sure the license plate number is a property in the most general class in the inheritance line (probably the <code>Vehicle</code> class). So you only have to deal with all the objects in a list by referring to them as their <code>Vehicle</code> class and then calling <code>Vehicle::GetLicensePlateNumber()</code>. Any vehicle requiring some special handling to retrieve the number can implement this behaviour by overriding the method and make it behave as required. So, a wide range of object types can be used as if they were of the same type, but can behave differently. </p></li> </ul>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload