×

Discussion Board

Results 1 to 3 of 3

Thread: CLASSES?

  1. #1
    Registered User
    Join Date
    Apr 2008
    Posts
    22

    Unhappy CLASSES?

    Hi everybody! I would like to know how to work with classes? I don't understand what "this" means in classes, which i see in all examples!

    THANKS A LOT FOR YOUR HELP!

  2. #2
    Super Contributor
    Join Date
    Oct 2007
    Location
    Deva, Romania
    Posts
    3,471

    Re: CLASSES?

    Hi darklord18,

    Classes are objects with attributes and methods, to put it bluntly. The attributes are the variables associated with the class, and the methods are the functions associated with the class.

    An example might illustrate what I mean:
    Code:
    #First, we name the class, in this case "Person"
    >>>class Person:
       
          #An attribute of the Person class is the variable "name"
          name="Alexander"
    
          #This function returns the name of the "person" 
          def getname(self):
             return self.name
    
          #This function sets the name of the "person" to the new value that is given
          def setname(self, name):
             self.name=name
    
    >>>p=Person()
    >>>p.getname()
    'Alexander'
    >>>p.setname("John")
    >>>p.getname()
    'John'
    "self" refers to the class' attribute. It's hard to explain, but just remember that it doesn't have to be specified when calling a function, only when defining it.

    Examples of classes are "app" from appuifw, or "Sound" from audio etc.

    For a more detailed tutorial about classes, go here.
    Last edited by bogdan.galiceanu; 2008-04-20 at 10:24.

  3. #3
    Nokia Developer Champion
    Join Date
    Feb 2008
    Location
    Ahmedabad, Gujarat, India
    Posts
    3,852

    Re: CLASSES?

    hi darkload18
    have a look at this. Hope this helps my suggestion to is look out for more code snippets and understand the concepts of classes.
    give a feedback.

Similar Threads

  1. Opinion on Netbeans mob-Pack Table classes
    By browndrf in forum Mobile Java General
    Replies: 0
    Last Post: 2007-04-23, 19:08
  2. Confused about R classes
    By Kebab300 in forum Symbian
    Replies: 1
    Last Post: 2006-02-02, 02:59
  3. T classes and destructors
    By profoundwhispers in forum Symbian
    Replies: 7
    Last Post: 2004-08-26, 10:02
  4. how do i use the nokia classes
    By ginanabil77 in forum Mobile Java General
    Replies: 0
    Last Post: 2003-12-16, 08:43
  5. Where are the classes?
    By nreddy in forum Mobile Java Tools & SDKs
    Replies: 0
    Last Post: 2003-08-10, 07:58

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×