You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

1.4 KiB

Lesson 01

Prequisites

  • Classes
  • Functions

Files

  • components/Point.cpp
  • components/Point.h
  • main.cpp

Task

  1. With the point-class we represent a single dot on screen, giving it a position and character as "image". Begin by inspecting components/Point.h and components/Point.cpp and figure out what a header (.h) and code (.cpp) file contain and how they differ.
  2. When an instance of a class in C++ is created, its constructor is used to initialize values. At some point, the created instance will get destroyed which uses the destructor. Read about these two and implement them in components/Point.cpp.
  3. Select to call mainL01 in main of main.cpp and think or read about the purpose of this function as the applications entry point.
  4. See what happens when you run the application now and play around with the point or maybe create multiple. You can also modify the destructor to do something special (like print to the command line).
  5. Go to components/Point.* again and look at the member variables x,y and img. Notice that they are defined in a "private" region. Try to modify these directly in the main function mainL01. If that does not work, you can implement the getters and setters marked with TODO in components/Point.cpp
  6. Continue exploring around with the point and see what happens.

Once you're ready, you can git merge lesson02.