Classes

Revision as of 19:41, 27 January 2007 by Adonis (talk | contribs) (New programming task)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

The purpose of this task is to create a basic class with a method, a constructor, an instance variable and how to instantiate it.

Task
Classes
You are encouraged to solve this task according to the task description, using any language you may know.

Python

 class MyClass:
 
     def someMethod(self):
         """
         Method
         """
         self.variable = 1
 
     def __init__(self):
         """
         Constructor
         """
         self.variable = 0    # Instance variable
 
 myclass = MyClass()