Difference between revisions of "Ruby/C3/Object-Oriented-Programming-Methods/Gujarati"
Jyotisolanki (Talk | contribs) |
Jyotisolanki (Talk | contribs) |
||
Line 1: | Line 1: | ||
|- | |- | ||
| | 03:59 | | | 03:59 | ||
− | | | | + | | | Next, let us look at what '''class methods '''are. |
|- | |- | ||
| | 04:04 | | | 04:04 | ||
− | | | | + | | | '''Class methods''' are '''methods '''available only to the '''class.''' |
|- | |- | ||
| | 04:09 | | | 04:09 | ||
− | | | | + | | |These '''methods '''are not available to '''instances''' of the '''class.''' |
|- | |- | ||
| | 04:14 | | | 04:14 | ||
− | | | | + | | |There are different ways you can define '''class methods'''. |
|- | |- | ||
| | 04:16 | | | 04:16 | ||
− | | | | + | | | Let us look at an example. |
|- | |- | ||
| | 04:18 | | | 04:18 | ||
− | | | | + | | | Create a new file in '''gedit '''as shown in the basic level '''Ruby tutorials'''. |
|- | |- | ||
| | 04:24 | | | 04:24 | ||
− | | | | + | | |Name it '''class_methods.rb'''. |
|- | |- | ||
| | 04:28 | | | 04:28 | ||
− | | | | + | | | I have a working example of '''class methods'''. |
|- | |- | ||
| | 04:32 | | | 04:32 | ||
− | | | | + | | |You can pause the tutorial and type the code as we go through it. |
|- | |- | ||
| | 04:36 | | | 04:36 | ||
− | | | | + | | | I have defined a '''Product class''' like before. |
|- | |- | ||
| | 04:40 | | | 04:40 | ||
− | | | | + | | | I have also called an '''initializer''', like before. |
|- | |- | ||
| | 04:44 | | | 04:44 | ||
− | | | | + | | |However, this time I have added an extra '''argument''' called '''description'''. |
Revision as of 11:47, 10 February 2016
|- | | 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.