CP1_11_string_Class_1_1112

CP1_11_string_Class_1_1112 - Classes: Classes: the string...

Info iconThis preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon
Classes: the string class (pt. 1)
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Intro to classes Structs allow us to define data types with member ariables to handle compound data variables to handle compound data. To go beyond this and add member functions as well, gy , we define a class. The class allows us to package together data (member variables) and related behaviour (member functions) into a single package. This process of packaging is called encapsulation . ariables declared with the class as their type are Variables declared with the class as their type are called objects of that class 2 CSIS1117B Computer Programming 1 2011-2012
Background image of page 2
Abstract data types There are good ways of programming with classes and there are bad ways. One feature of good classes is that ey are also bstract data types they are also abstract data types . An abstract data type is a collection of values and a set of operations defined on those values. A class allows use to define these as member variables and member functions. But abstract data types have another important property: To use the abstract data type, we don't need to know anything about how the values are represented in the lass, or how the operations are implemented. You've seen this already for pre-defined types like int and class, or how the operations are implemented. double , and you've also seen it for string 3 CSIS1117B Computer Programming 1 2011-2012
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
The Standard string Class n previous lectures and tutorials, you've seen and
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 11

CP1_11_string_Class_1_1112 - Classes: Classes: the string...

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online