+ 1
Please tell me about methods
Methods
3 ответов
+ 2
Hey!
If you're talking ab OOP, a method is a function inside a class.
Methods usually work the same as functions, but you need to access them through the object.
Also, there's some special methods, for example a constructor method that initialises the object when you create it, or a destructor that gets called when an object goes out of scope to release memory.
I suggest you to learn OOP, you will learn about any method there is to know based on your programming language choice.
+ 2
Kareema ,
A function is a block of code that performs a specific task and can be called from within a program. It is declared using the `def` keyword.
a method is a function that is part of an object or class and is called on that object (so it is bound to objects).
a function can operate on passed arguments (optionally), while a method operates on the data stored within an object.
0
Thanku so much