Ruby/C3/Object-Oriented-Programming-Methods/Gujarati
|- | | 03:59 | | Next, let us look at what class methods are.
|- | | 04:04 | | Class methods are methods available only to the class.
|- | | 04:09 | |These methods are not available to instances of the class.
|- | | 04:14 | |There are different ways you can define class methods.
|- | | 04:16 | | Let us look at an example.
|- | | 04:18 | | Create a new file in gedit as shown in the basic level Ruby tutorials.
|- | | 04:24 | |Name it class_methods.rb.
|- | | 04:28 | | I have a working example of class methods.
|- | | 04:32 | |You can pause the tutorial and type the code as we go through it.
|- | | 04:36 | | I have defined a Product class like before.
|- | | 04:40 | | I have also called an initializer, like before.
|- | | 04:44 | |However, this time I have added an extra argument called description.