This preview shows page 1. Sign up to view the full content.
Unformatted text preview: mically allocated arrays
x Perform some class-specific actions when the object is
created Bookkeeping, initialize default values, etc.
x Have user-defined creation of objects, taking arguments as
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
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:
; Accessing it:
; // mycar.size()
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.
- Fall '00