100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
Cisc 181 exam 2 questions & answers 2024/2025 $7.99   Add to cart

Exam (elaborations)

Cisc 181 exam 2 questions & answers 2024/2025

 9 views  0 purchase
  • Course
  • Cisc 181
  • Institution
  • Cisc 181

Cisc 181 exam 2 questions & answers 2024/2025 Default values - ANSWERSAny method or function can provide default values for its parameters in the function signature We can add methods to our classes to create ___ that ___ methods that can work on that data - ANSWERSObjects, encapsulates ...

[Show more]

Preview 2 out of 5  pages

  • August 8, 2024
  • 5
  • 2024/2025
  • Exam (elaborations)
  • Questions & answers
  • Cisc 181
  • Cisc 181
avatar-seller
Bensuda
Cisc 181 exam 2 questions & answers
2024/2025

Default values - ANSWERSAny method or function can provide default values for its parameters in the
function signature



We can add methods to our classes to create ___ that ___ methods that can work on that data -
ANSWERSObjects, encapsulates



If member variables are public, we can't - ANSWERSChange the internal representation (ex: Person class
with age variable set as number, but later on I change it to string, this messes the code all up). Accessible
from anywhere. Can access public members in subclass



Super - ANSWERSCalls constructor of parent and rages whatever args as constructors



If they are private, - ANSWERSHides info from users. Our class will have a public interface which may be
separate from its internal representation. Can be changed so long that the public interface still works as
expected (since users don't have direct access anyways)



How to deep copy? - ANSWERSTeach each class how to clone itself, then use these methods if we have a
class that contains another class (composition)



What if it contains a primitive type inside? - ANSWERSIf we use spread it creates shallow copy. We need
to iterate through the array given, clone each, create a new array of clones that we can pass to
constructor of the new object



Method - ANSWERSA function that is associated with an object and called using dot notation.



Composition - ANSWERSWhen a class contains another class we add the second class as a property of
the first

, Inheritance - ANSWERSBuild complex hierarchies of objects in order to define new types that are a type
of some existing type



is-a vs. has-a - ANSWERS- Is-A: used to describe -> child of a parent class

- Example: Inheritance

Phone class is a (or is a type of) Device (also a class)



- Has-A:

-> Is used to describe the characteristics that define an object

data members that have a relationship to the class

-> Example: composition

Class Color is used in Class Point. The point has a (or contains a) color



Extends - ANSWERScreates the inheritance relationship between subclass (child) and superclass (parent).
What we extend- the superclass

What we create by extending- subclass



How to call superclass constructor within subclass constructor - ANSWERSSuper() takes same args as
constructor of superclass



Private - ANSWERSOnly accessible within the class.

Changes made effect nothing outside of the class. Can't access private members in subclass/child class



Protected - ANSWERSOnly accessible within class or any defined subclasses. Allows child class to modify
member variables in parent. Changes made only break classes inherited from it/ subclasses. Can access
protected members in subclass



Override - ANSWERSBy creating a method w the same signature (name, parameter and type, return
type) as a method in superclass.

Express diff behaviors in subclasses, while allowing us to have default implementations (when we call
super within method)

The benefits of buying summaries with Stuvia:

Guaranteed quality through customer reviews

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

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

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 Bensuda. 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.

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

80461 documents were sold in the last 30 days

Founded in 2010, the go-to place to buy study notes for 14 years now

Start selling
$7.99
  • (0)
  Add to cart