AP CS 6: Classes

Premium Lesson

This is a premium course. To view and assign premium course, you must upgrade your account

Upgrade Now

Course Items

Introduction to Classes

A Class is a custom data type. Classes can represent more complex data than integers or strings.

Class Methods

Classes, in addition to holding several properties, can also contain methods

Private access methods

A private method is one which can only be used within the Class where it is defined

Public Access Methods

A public method is one that is available to processes outside of the Class itself

Getter Methods

Getter methods are public methods that allow users to read the value of private class members without offering them the ability to overwrite these values

Setter Methods

Setters are public access methods that allow users to write to private property fields. These may come with protections to prevent users from writing invalid data

Mutator Methods

Mutators are methods that change the value of the object they are called on

Complex Numbers

For the next few lessons, we will be making a complex number class to illustrate the concepts we've learned

Complex Arithmetic

Adding arithmetic computations to our Cnum class

Copy Constructor

A copy constructor allows you to duplicate an object by passing it into the constructor of the same class. In this lesson we will pass a Cnum to a new Cnum in order to make a duplicate of the original.

Static Class Methods

Static Class methods let us call methods directly on the Class, rather than on a specific Object of the Class

AP CS 6: Classes Info

Track

AP Computer Science

Account

MVCode

Rank

Hacker

Created By

jamie

AP CS 6: Classes Prereqs