Constructor (object-oriented Programming) - Ruby

Ruby

In Ruby, constructors are created by defining a method called initialize. This method is executed everytime a new instance is created.

class ExampleClass def initialize return "Hello there" end end exampleInstance = ExampleClass.new puts exampleInstance # => "Hello there"

Read more about this topic:  Constructor (object-oriented Programming)

Famous quotes containing the word ruby:

    Its quick silver bell beating, beating
    And down the dark one ruby flare
    Pulsing out red light like an artery,
    Karl Shapiro (b. 1913)

    Lay down, lay down the bigly bier,
    Lat me the dead look on;
    Wi’ cherry cheeks and ruby lips
    She lay an’ smil’d on him.

    O ae sheave o’ your bread, true-love,
    An’ ae glass o’ your wine,
    For I hae fasted for your sake
    These fully day [is] nine.
    Anna Gordon Brown (1747–1810)

    It is better to be looked over than overlooked.
    Mae West, U.S. actor, screenwriter, and Leo McCarey. Ruby Carter (Mae West)