In deze les zitten 17 slides, met interactieve quizzen en tekstslides.
Lesduur is: 45 min
Onderdelen in deze les
Introduction to Object-Oriented Programming
Slide 1 - Tekstslide
What are some things that every person has in common?
Slide 2 - Open vraag
What is a Class?
A class is a blueprint of code that is used to create objects.
Analogy. Humanity is a class. Although individual people are different, we all follow the same blueprint.
Slide 3 - Tekstslide
Thinking about things that exist in the world, what are examples of classes?
Slide 4 - Open vraag
What is an Object?
An object is created from a class. It is an example of that class. If we had a class called "Car", the "Ford Mustang" would be an object of that class. An object is an instance of a class.
Slide 5 - Tekstslide
Out of each pair, decide which one is the class and which one is the object.
Classes
Objects
Fish
Tuna
Monkeys
Mammal
Car
Honda
Island
Exuma
Bahamas
Country
Slide 6 - Sleepvraag
How can classes be helpful in code?
Slide 7 - Open vraag
Constructors
This is a special method within a class that get called when an object is created. It can be used to set the values in the class.
Slide 8 - Tekstslide
Methods
Methods are FUNCTIONS inside a class/object
Slide 9 - Tekstslide
Properties
Properties are variables in a class that represent values related to that class. If we had a class called "Car", examples of properties could be "make", "model", and "year". What other properties would make sense to have in our "Car" class?
Slide 10 - Tekstslide
Slide 11 - Tekstslide
Code your first class!
Code a class called "Student"
In your constructor, set AT LEAST 2 properties called "Name" and "Grade".
Code a method called "Greeting" that returns AT LEAST the name and grade of the student.
Use this class as an example
Slide 12 - Tekstslide
What is a class in object-oriented programming?
A
A function for data processing.
B
A programming language.
C
A blueprint for creating objects.
D
A type of database structure.
Slide 13 - Quizvraag
What is an object in OOP?
A
A library of functions.
B
A programming error.
C
A type of variable.
D
An instance of a class.
Slide 14 - Quizvraag
What is a constructor?
A
A file format for programs.
B
A type of data storage.
C
A framework for testing code.
D
A method for setting properties when creating objects.