Key Takeaways

  • Class acts as a template used to create objects.
  • Class describes the behavior and state that an object can hold.
  • Every object is an instance of a class.
  • Instance methods live in the class.
  • Instance variables live in the object.
  • Instance variables are unique to each object.
  • By default, instance variables are hidden from the outside.
  • We can expose instance variable via an accessor.
  • You can over-ride the to_s method to customize the inspect message.
  • Everything is an object is true for Smalltalk but not for Ruby.
  • Every sender and receiver in a message passing interaction is an object.
  • Sender can be explicit or implicit.
  • Sender is the owner of the scope where the message originated.
  • The dot notation makes sending messages explicit.
  • If the receiver and the sender is the same, you can omit the receiver and the dot.
  • There is always a receiver.
  • There is always a sender.
  • There is always a message that passes between the sender and the receiver.
  • You cannot provide an explicit receiver to call a private method.
  • You have to call the private method in functional form.
  • Everything in the inheritance hierarchy is an Object.
  • Receiver and Sender in a message sending interaction are objects.
  • Every class is an object. In other words, every class is an instance of a Ruby built-in class called Class.
  • Every object is an instance of a class.
  • Every class has a superclass.
  • Everything happens by sending messages.
  • Method lookup follows the inheritance chain.
  • Class methods and singleton methods are the same.
  • User defined classes and Ruby's built-in classes are objects.
  • User defined classes and Ruby's built-in classes are instances of class called Class.

results matching ""

    No results matching ""