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:

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

    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)

    A man in the house is worth two in the street.
    Mae West, U.S. actor, screenwriter, and Leo McCarey. Ruby Carter (Mae West)