Example:
class YourName < Library::Method
# code in here
end
I see it all the time in ruby and I have no idea what it means.
What is a class in Ruby? Classes are the basic building blocks in Object-Oriented Programming (OOP) & they help you define a blueprint for creating objects. Objects are the products of the class.
But from Ruby 1.9 version, BasicObject class is the super class(Parent class) of all other classes in Ruby. Object class is a child class of BasicObject class. Syntax: subclass_name < superclass_name. Example: Ruby.
In Ruby, a class is an object that defines a blueprint to create other objects. Classes define which methods are available on any instance of that class. Defining a method inside a class creates an instance method on that class. Any future instance of that class will have that method available.
In Ruby, single class inheritance is supported, which means that one class can inherit from the other class, but it can't inherit from two super classes. In order to achieve multiple inheritance, Ruby provides something called mixins that one can make use of.
This is the inheritance operator (<
)
It means "YourName inherits from Library::Method"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With