csci 2467 final Questions and Answers with complete solutions
11 views 0 purchase
Course
Csci 2467
Institution
Csci 2467
Encapsulation - a fundamental principle of object-oriented programming, whereby the internal
components of a class are hidden from external classes and are only accessed via getter / setter
methods.
Why use encapsulation? - so that you can change the internal implementation of a class without
a...
csci 2467 final
Encapsulation - a fundamental principle of object-oriented programming, whereby the internal
components of a class are hidden from external classes and are only accessed via getter / setter
methods.
Why use encapsulation? - so that you can change the internal implementation of a class without
affecting other classes.
instantiation - Process of creating an object, an instance of a class; creates space in memory for
the new object and binds a name for the object with the object's data in memory.
OOP - programmers create classes to define new complex data types
Class - a programmer defined data type. A class is a data type definition composed of attributes
(or fields, properties, or instance variables) consisting of primitive data types and references to other
class objects and methods that interact with these attributes.
object - a specific instance of a class. Can be created via the new operator (instantiation)
Object's attributes define what - the state of the object
Object's methods define what - the behavior of the object
A class consists of 3 parts - - 1. name 2. attributes (primitives and/or references to other class
objects) 3. methods
Getters - Methods for obtaining the value of an object's attributes.
Setters - Methods for updating an object's attributes, but do not have a return value.
, constructor - Used to create objects of a class
public method - visible to external classes
private method - only visible within the class it is defined
What is declared as private? What is declared as public? - Attributes are private, constructors,
getters, and setters are public.
programming dependency - a class that you write that can be used by other programmers.
Heap Memory - Global properties in an object and objects themselves are stored in the "heap"
area of a program's memory. Reference types are always on heap and it also has value types
Stack Memory - Local method properties are stored in the "stack" area of memory. Data must
have a known, fixed size. Has value types
has-a relationship - association relationship between objects
is-a relationship - inheritance relationship between objects.
static variable - class variable and is shared by all instances of the class.
static method - class method, not associated with one particular object. Can be called without
having to create an instance of the class.
static methods can access... - static variables, but cannot access instance variables.
The benefits of buying summaries with Stuvia:
Guaranteed quality through customer reviews
Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.
Quick and easy check-out
You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.
Focus on what matters
Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!
Frequently asked questions
What do I get when I buy this document?
You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.
Satisfaction guarantee: how does it work?
Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.
Who am I buying these notes from?
Stuvia is a marketplace, so you are not buying this document from us, but from seller ACADEMICMATERIALS. Stuvia facilitates payment to the seller.
Will I be stuck with a subscription?
No, you only buy these notes for $7.99. You're not tied to anything after your purchase.