{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

COMP SCIStudy Guide Test 3

COMP SCIStudy Guide Test 3 - Study Guide Test 3 Definition...

Info icon This preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Study Guide Test 3 * Definition of terms in OOP: abstraction, encapsulation, information hiding, inheritance, polymorphism the object Lassie is an instance of the Dog class. The set of values of the attributes of a particular object is called its state .The object consists of state and the behaviour that's defined in the object class. "The process by which an object sends data to another object or asks the other object to invoke a method." [1] Also known to some programming languages as interfacing Inheritance- "Subclasses" are more specialized versions of a class, which inherit attributes and behaviors from their parent classes, and can introduce their own. Only need to write code inherited from super class once. Each subclass can alter its inherited traits. In fact, inheritance is an "is-a" relationship: Lassie is a Collie . A Collie is a Dog. Inheritance is the capability of a class to use the properties and methods of another class while adding its own functionality. The concept of inheritance greatly enhances the ability to reuse code as well as making design a much simpler and cleaner process. Superclass & subclass Encapsulation - conceals the functional details of a class from objects that send messages to it. Encapsulation is achieved by specifying which classes may use the members of an object. The result is that each object exposes to any class a certain interface — those members accessible to that class. The reason for encapsulation is to prevent clients of an interface from depending on those parts of the implementation that are likely to change in future, thereby allowing those changes to be made more easily, that is, without changes to clients. Encapsulation is the ability of an object to be a container (or capsule) for related properties (ie. data variables) and methods. Information Hiding- is the ability of objects to shield variables from external access. These private variables can only be seen or modified by use of object accessor and mutator methods. This permits validity checking at run time. Access to other object variables can be allowed but with tight control on how it is done. Methods can also be completely hidden from external use. Those that are made visible externally can only be called by using the object's front door Polymorphism- is the capability of an action or method to do different things based on the object that it is acting upon. This is the third basic principle of object oriented
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
programming. Overloading and overriding are two types of polymorphism. Polymorphism is the ability of objects belonging to different data types to respond to method calls of methods of the same name, each one according to an appropriate type-specific behavior. Overloaded methods are methods with the same name signature but either a different number of parameters or different types in the parameter list. For example 'spinning' a number may mean increase it, 'spinning' an image may mean rotate it by 90 degrees. By defining a method for handling each type of parameter you achieve the effect that you want.
Image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern