Introduction

 < Day Day Up > 



A computer program consists of data and instructions that manipulate data. How data is modeled in source code is the primary topic of this chapter.

The C++ programming language provides facilities for creating your own data types. Up to now you have only been exposed to the fundamental data types C++ has to offer like char, int, and float. You can further abstract the problem you’re trying to solve by renaming these fundamental data types using the typedef (type definition) keyword. You saw an example of this being done in the function pointer section of chapter 9.

You can also create your own data types using the enum (enumeration), struct (structure), and class keywords. The enum keyword lets you create enumerated data types. By using enumerated types you can add a level of clarity to your program difficult to achieve otherwise. The struct and class keywords let you create complex, custom data types best suited to model the problem you are trying to solve.

In this chapter you will learn how to use typedefs, enumerations, and structures in your programs. You will also be introduced to classes and learn the fundamental differences between structures and classes.

This is an important chapter! After learning the material in this chapter you will know enough C++ to start solving real-world problems. You will also be prepared to approach the detailed study of classes and object-oriented design methodologies presented in subsequent chapters.



 < Day Day Up > 



C++ for Artists. The Art, Philosophy, and Science of Object-Oriented Programming
C++ For Artists: The Art, Philosophy, And Science Of Object-Oriented Programming
ISBN: 1932504028
EAN: 2147483647
Year: 2003
Pages: 340
Authors: Rick Miller

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net