Adding Methods in a Class
Learn how to write a method in a class and access it.
We'll cover the following
The classes most often contain functions. A function inside a class is called a method.
How to add a method in class?
In line 7, we add the method hello()
to the class with the prefix public
.
Create a free account to view this lesson.
By signing up, you agree to Educative's Terms of Service and Privacy Policy