cs31 lecture 17

Cs31 lecture 17

Info iconThis 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

This note was uploaded on 04/03/2014 for the course CS 31 taught by Professor Melkanoff during the Fall '00 term at UCLA.

Ask a homework question - tutors are online