Classes & Objects Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

What is a basic definition of a class (what is it used for)?

A

Basically, it is used to represent entites.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What does a member function do?

A

Used to add additional functionality to a class.
(Ex. Output values of a variable)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What does the “this” keyword do?

A

Very important keyword that is used to point to the current object.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What do class modifiers do?

A

Can be used to define the visibility or accessibility of the properties of a class or methods.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

List and define the 3 main class modifiers.

A

Private - Properties/methods are only available to the class itself.
Protected - Properties/methods are only available to the class itself and subclasses derived from the class.
Public - Properties/methods are available to all classes.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is a constructor?

A

Constructors are special methods in a class that are called when an object of the class is created. (A constructor has the name of the class).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What does the “static” keyword do?

A

This is used when assigning something and is used to define values that remain the same across all objects of a class.
(Ex. public static int Counter).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly