1. Define the Following OO Terms and How They Relate to Each Other

1. Define the Following OO Terms and How They Relate to Each Other

<p>1. Define the following OO terms and how they relate to each other Class, Object, Method</p><p>A class is a description of what the objects produced from the class will look like. A class is usually comprised of variable and method definitions. An object is an instance of a class. It is the most basic element in OO design. A method is a “behavior” that describes what an object can do. A method receives messages and performs a set of operations – usually on the object the method is contained in.</p><p>2. Describe inheritance and polymorphism as it applies to OO design Give a real world example of when you would use inheritance that we haven't used in class.</p><p>Inheritance is the term used to describe the relationship between general categories and more specific categories. In Java, inheritance is a mechanism that enables one class to inherit both behavior and attributes from another class. A good example of inheritance is the relationship between Motor Vehicles and Cars and Boats. Cars and Boats are both more specific types of the general category Motor Vehicles. In this example Motor Vehicles is a superclass and Cars and Boats are subclasses.</p><p>Polymorphism technically means “many forms”. It refers to the way different objects can respond in their own way to the same message. For example, different objects of type Birds, Dogs and Cats can receive the message Speak. The Bird object will respond “Tweet”, the Dog object will respond “Woof”, and the Cat object will respond “Meow”.</p><p>3. What does encapsulation mean and what are its benefits?</p><p>Encapsulation means that an object has attributes and methods combined into one unit. This means that you do not need to know the internal structure of the object to send messages to it. You only need to know what an object can do for you. Encapsulation hides the internal structure of objects, also protecting them from corruption.</p>

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    1 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us