{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

cs31 lecture 17

G a object x the converse is not true example example

Info icon This preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: mically allocated arrays x Perform some class-specific actions when the object is Perform created created Bookkeeping, initialize default values, etc. x Have user-defined creation of objects, taking arguments as Have input input x Debugging You can trace easily when objects are being created/destroyed 124 Dynamic arrays in C++ with the STL x Manipulating arrays has been annoying so far! Manipulating x The Standard Template Library provides generic one-dimensional The arrays, whose size is automatically managed arrays, x They are called std::vector x Typical operations: Declare an array of object Car: std::vector<Car> myvector; Adding an element to it, at the end: myvector.push_back(Car()
)
; Accessing it: myvector[0].displayId()
; // mycar.size()
 is available 125 Inheritance x Probably the most powerful concept in OOP x Basic idea: a class can inherit from another class It inherits all its attributes and methods It can of course have new methods/attributes It can redefine attributes and methods x Some terminology: The parent class: superclass The current class (which inherits from some class)
: the subclass 126 S...
View Full 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