Class

A class is a blueprint for creating objects. It defines the properties (data) and methods (actions) that objects of that type will have.

General Programming

Examples

Python

class Dog:
    def __init__(self, name):
        self.name = name
    def bark(self):
        return f"{self.name} says woof"

print(Dog("Rex").bark())

Output:

Rex says woof

Learn it in a lesson

See also

Back to the Dictionary