Search the courses, subjects, tracks, games and features, or jump straight to a page.
2 cards from this section. Quick, good the night before a test.
What is a class in programming?
Think of it as a template.
Name two attributes of the Car class.
Think about the properties a car has.
What data types are the attributes of the Car class?
Consider the types of data each attribute is representing.
True or False: A method in a class defines the attributes of an object.
Reflect on the definitions of methods and attributes.
Modify the Car class to include a method that allows the car to display its current state, including both its color and speed. What would that method look like?
Think about how to format the output string.
Create an extension of the Car class called SportsCar that inherits from Car and adds a new attribute for horsepower. How would you define this new class?
Ensure to incorporate the concept of inheritance here.
4 more questions in this section. Enroll free to practise them all.
Enroll free