Page 5 of 9 FirstFirst 123456789 LastLast
Results 41 to 50 of 86
  1. #41
    Join Date
    Sep 2006
    Location
    Evanston, Illinois.
    Posts
    2,361
    Tokens
    0

    Latest Awards:

    Default

    lmao, the only person who even thinks about polymorphism ont hese forums is caleb, who else could it be...
    How could this hapen to meeeeeeeeeeeeeee?lol.

  2. #42
    Join Date
    Mar 2008
    Posts
    173
    Tokens
    0

    Default

    Actually, the person who taught me about polymorphism is Tomm.

  3. #43
    Join Date
    Feb 2008
    Location
    Plymouth
    Posts
    1,073
    Tokens
    0

    Latest Awards:

    Default

    Stuff polymorphism, looks too complicated :'\ But do they use it in Habbo? For the pets?

    HTML Code:
     class Animal:
        def __init__(self, name):    # Constructor of the class
            self.name = name
     
    class Cat(Animal):
        def talk(self):
            return 'Meow!'
     
    class Dog(Animal):
        def talk(self):
            return 'Woof! Woof!'
     
    a = Cat('Missy')
    b = Cat('Mr. Bojangles')
    c = Dog('Lassie')
     
    for animal in (a, b, c):
        print animal.name + ': ' + animal.talk()
     
    # prints the following:
    #
    # Missy: Meow!
    # Mr. Bojangles: Meow!
    # Lassie: Woof! Woof!

  4. #44
    Join Date
    Mar 2008
    Posts
    173
    Tokens
    0

    Default

    PHP Code:
    <?php

    require_once ('en/classes/core.php');

    class 
    demonstration extends core {
        
        
    /**
         * 
         */
        
    public function __construct() {
            
    parent::__construct ();
            
    //TODO - Construct
        
    }
        
        
    /**
         * 
         */
        
    function __destruct() {
            
        
    //TODO - Destruct
        
    }
    }

    ?>

  5. #45
    Join Date
    Feb 2008
    Location
    Plymouth
    Posts
    1,073
    Tokens
    0

    Latest Awards:

    Default

    And that is..?

  6. #46
    Join Date
    Mar 2008
    Posts
    173
    Tokens
    0

    Default

    Just a normal PHP class, that extends the class core.

  7. #47
    Join Date
    Sep 2006
    Location
    Evanston, Illinois.
    Posts
    2,361
    Tokens
    0

    Latest Awards:

    Default

    I tried using OOP for a PM system for my backend, it failed unsuprisingly, shame really, I don't really know wheer to start with learning real OOP.
    How could this hapen to meeeeeeeeeeeeeee?lol.

  8. #48
    Join Date
    Mar 2008
    Posts
    173
    Tokens
    0

    Default

    You first need to learn the "theory" of it, how it works, and how it can be used in your application.

    OOP is not just a thing.. it is a whole practice and technique.

  9. #49
    Join Date
    Sep 2006
    Location
    Evanston, Illinois.
    Posts
    2,361
    Tokens
    0

    Latest Awards:

    Default

    Where do I start on learning the thoery?
    How could this hapen to meeeeeeeeeeeeeee?lol.

  10. #50
    Join Date
    Mar 2008
    Posts
    173
    Tokens
    0

Posting Permissions

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