Learn

Perfect! Now let’s class things up a bit with a class variable.

Instructions

1.

Give your Message class a @@messages_sent class variable and set it equal to 0. In the body of your initialize method, increment this value by 1 so that each time a new Message object is created, @@messages_sent will increase by 1. Don’t create any instances of your class just yet!

Take this course for free

By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.
Already have an account?