OOPLec06

21
Object Oriented Paradigm Lecture # 06 Objects with Pointers, References, and Arrays

description

oop

Transcript of OOPLec06

PowerPoint Presentation

Object Oriented ParadigmLecture # 06Objects with Pointers, References, and Arrays

1

OutlineArrays of ObjectsMemory Management: the new and delete OperatorsDefining Dynamic ObjectsPointer to ObjectReference to ObjectArray of Pointers to Objects2

2

Defining Arrays of ObjectsWe may define arrays of objectsIn the example below we see an array with ten elements of type Point

void main() {Point array[10]; // defining an array with ten objectsarray[0].move(15,40); // moving first object (index 0)array[1].move(75,35); // moving second object (index 1)// so onfor(int i= 0;i