0
Can i define a FUNCTION in a class and If yes then how can i access on an object or it is not possible to define a function??
Or it is only allowed to define method in a class??
3 Answers
+ 1
Yes, you can define functions inside class. For python, it is simple by def func().. You access it with . notation, such as obj.func(). But it is possible for public functions, if you want to access them outside the class.
0
For example??
0
A function in a class is CALLED a method. The difference is just the vocabulary.