This community-built FAQ covers the “Up, Up, and Away!” exercise from the lesson “Object-Oriented Programming I”.
Paths and Courses
This exercise can be found in the following Codecademy content:
Learn Ruby
FAQs on the exercise Up, Up, and Away!
There are currently no frequently asked questions associated with this exercise – that’s where you come in! You can contribute to this section by offering your own questions, answers, or clarifications on this exercise. Ask or answer a question by clicking reply (
) below.
If you’ve had an “aha” moment about the concepts, formatting, syntax, or anything else with this exercise, consider sharing those insights! Teaching others and answering their questions is one of the best ways to learn and stay sharp.
Join the Discussion. Help a fellow learner on their journey.
Ask or answer a question about this exercise by clicking reply (
) below!
Agree with a comment or answer? Like (
) to up-vote the contribution!
Need broader help or resources? Head here.
Looking for motivation to keep learning? Join our wider discussions.
Learn more about how to use this guide.
Found a bug? Report it!
Have a question about your account or billing? Reach out to our customer support team!
None of the above? Find out where to ask other questions here!
My code has passed the task but I still have doubts if I understood well the following instruction: Pass Email
‘s initialize
method the same two parameters passed to Message
‘s— from
and to
This is how I interpret:
class Email < Message
def initialize (from, to)
@from = from
@to = to
super
Doesn’t feel right to me. Any thoughts?
There is no error in your code, but it is superfluous to have the initialize also set the instance variables.
This is the optimized solution - so when super is called it will execute the parent’s initialize method and set the instance variables.
class Email < Message
def initialize(from, to)
super
end
end
I don’t see the purpose of overriding a method only to do the exact same thing.
If we wanted to have an email inherit the “from” and “to” from the Message class, but ALSO store the subject variable, would this be the appropriate code?:
class Email < Message
def initialize(from, to, subject)
super
@subject = subject
end
end
Here, does super automatically pass from and to back into the parent Message class? Also, would we use a @@subject to make it a child class attribute, or would subject be an instance-only attribute?
I feel like the it was just to use ‘super’ in the exercise as practice than a real reason to do the exact same thing.
Someone more knowledge may correct me if I am wrong though.
Hello, well I would like to say, that I do not understand what is the purpose of the last excercise (from 16 to 20), since it produces nothing in the console.
I would recommend to change, modify and improve this last 4 excercise. So students/learners could see what is changing and what is going on here.
Honestly, without anything in the console it is pretty hard to understand its functionality.
I passed it with the help of the hints and solutions, but no idea what is that for…
2 Likes