After you have read and studied this chapter, you should be able to: Declare and manipulate data of the char data type; write string processing program, applicable in areas such as bioinformatics, using String, StringBuilder, and StringBuffer objects; differentiate the three string classes and use the correct class for a given task; specify regular expressions for searching a pattern in a string; use the Pattern and Matcher classes; compare the String objects correctly. | CSC241: Object Oriented Programming Lecture No 17 Previous lecture Multiple inheritance Example program: employ and student class Constructor in multiple inheritance Example program Composition Today’s lecture Example program – inheritance Relationship between class Association Aggregation Composition Memory management String class Example program Problem statement Various situations require that pairs of numbers be treated as a unit. For example, each screen coordinate has an x (horizontal) component and a y (vertical) component. Derive a new class pairStack from Stack that allow to store pair variables on a stack using a single call to a push() push(st); // st is a structure type variable retrieve using a single call to pop() function, st = pop(); Go to program Association It is a simple connection or channel between classes It is a relationship where all objects have their own lifecycle and there is no owner Example: Department and student Multiple students can associate with . | CSC241: Object Oriented Programming Lecture No 17 Previous lecture Multiple inheritance Example program: employ and student class Constructor in multiple inheritance Example program Composition Today’s lecture Example program – inheritance Relationship between class Association Aggregation Composition Memory management String class Example program Problem statement Various situations require that pairs of numbers be treated as a unit. For example, each screen coordinate has an x (horizontal) component and a y (vertical) component. Derive a new class pairStack from Stack that allow to store pair variables on a stack using a single call to a push() push(st); // st is a structure type variable retrieve using a single call to pop() function, st = pop(); Go to program Association It is a simple connection or channel between classes It is a relationship where all objects have their own lifecycle and there is no owner Example: Department and student Multiple students can associate with single department Single student can associate with multiple departments No ownership Both can create and delete independently Aggregation It is a form of association where all object have their own lifecycle but there is a ownership like parent and child Represents as “has a” relationship Implementation details: Use pointer variables that points to object of other class Can use a reference variables that points to object of other class Not responsible for creation/destruction of subclass Cont. Example: Employee and Company A single employee cannot belong to multiple company. If we delete the company, Employee object will not destroy Employee e(6, “ali”); ID 6 name ali e Company C(“MS”, &e); c *emp name ali Go to program Composition It is a specialize form of aggregation. It is a strong composition Parent and child objects have coincident lifetimes Child object dose not have its own lifecycle If parent object gets deleted, then all of its child objects will also be deleted Cont. .