Introduction to OOP | Chapter 18: Generics : | next | previous | audio | real | text |
iBox.setValue(3.1415); // ERROR - invalid type Box <double> dBox(2.7); cout << dBox.getValue(); 2.7 dBox.setValue(3.1415); cout << dBox.getValue(); 3.1415 iBox = dBox; // ERROR - mismatched typesIn the next chapter we will see how generics are used to create collection classes.