+ 1

Please tell me about methods

Methods

21st Oct 2025, 2:13 PM
Kareema
Kareema - avatar
3 Antwoorden
+ 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.
21st Oct 2025, 3:15 PM
Linux
Linux - avatar
+ 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.
21st Oct 2025, 3:52 PM
Lothar
Lothar - avatar
0
Thanku so much
21st Oct 2025, 4:57 PM
Kareema
Kareema - avatar