A class is a core concept of object-oriented programming. It provides a template for creating instances of this class. Besides data, classes also have behavior (methods) associated with them.
A class is a type of product type.
- What is a class? Why use classes?
- How to define classes. What is the syntax to define a class?
- How to create instances of a class. The syntax to create a new instance of a class.
- Access members of a class. How to use fields/methods on a class instance.
This exercise models a remote control car that keeps track of the distance it has driven and its battery charge percentage. The reference implementation (C#) teaches:
- Defining a class.
- Creating an instance of a class.
- Defining a field on a class.
- Update a field on a class.
- Restrict access to fields using access modifiers
Track | Exercise | Changes |
---|---|---|
C# | classes | None |