Howto:Understand Namespaces and Methods: Difference between revisions

Jump to navigation Jump to search
No edit summary
Line 47: Line 47:


For example, to switch off the lights in the bath room, there could be a method "switch_off_lights" in the "house" class:
For example, to switch off the lights in the bath room, there could be a method "switch_off_lights" in the "house" class:


house.bath.switch_off_lights
house.bath.switch_off_lights


Obviously, this will only work if the switch off routine (method!) has some house to work with. The class itself really is just a "template" for functionality, before it can be used it needs to be instantiated, i.e. a new object must be created using the template, and then the member functions (methods) can be called.
Obviously, this will only work if the switch off routine (method!) has some house to work with. The class itself really is just a "template" for functionality, before it can be used it needs to be instantiated, i.e. a new object must be created using the template, and then the member functions (methods) can be called.


== More Information ==
== More Information ==
139

edits

Navigation menu