Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Методи
- Method – a named piece of code
- Методите вдигат абстракцията. Когато мислим за нещо, което трябва да бъде свършено, може да използваме конкретен метод за това нещо, без да има нужда да разбираме кода в конкретния метод и без дори да гледаме кода в този метод
- A method can contain optional parameters:
- static void PrintNumbersInRange(int start = 0, int end = 14)
- {
- …
- }
- PrintNumbersInRange();
- PrintNumbersInRange(2, 7);
- PrintNumbersInRange(end: 12, start: 8);
- Method return types:
- - Type void – does not return a value (only executes code)
- - Other types – return values, based on the return type of the method
- Сигнатура на метод – името на метода и съвкупността от параметри, които приема
- Method overloading – use the same method name for multiple methods with different parameters
Add Comment
Please, Sign In to add comment