{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Classes - Classes Dr David A Gaitros Florida State...

Info icon This preview shows pages 1–7. Sign up to view the full content.

View Full Document Right Arrow Icon
Source: Absolute C++, Savitch, Addison-Wesley Classes Dr. David A. Gaitros Florida State University
Image of page 1

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

View Full Document Right Arrow Icon
Source: Absolute C++, Savitch, Addison-Wesley Classes A sophisticated structure within a programming language that has associated with a single name: public member functions private member functions (can only be used by the class) public data ( rare) private data (most common) 6-2
Image of page 2
Source: Absolute C++, Savitch, Addison-Wesley Object The value of a variable is called an object. An object has both data members and data functions. When programming in classes a program is viewed as having a collection of objects (things that have data and functions that use the data) 6-3
Image of page 3

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

View Full Document Right Arrow Icon
Source: Absolute C++, Savitch, Addison-Wesley Classes Similar to structures Adds member FUNCTIONS Not just member data Integral to object-oriented programming Focus on objects Object: Contains data and operations In C++, variables of class type are objects 6-4
Image of page 4
Source: Absolute C++, Savitch, Addison-Wesley Class definition usually has two distinct parts: Class definition usually written as a .h file. Does not contain executable code but provides the compiler with the visible definitions of the class (What the programmer who is using the class can use.) Class implementation usually written as a .cpp file. Includes (#include) the .h file and contains all of the code that make the class work. 6-5
Image of page 5

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

View Full Document Right Arrow Icon
Source: Absolute C++, Savitch, Addison-Wesley Old Style Data and functions were defined separately Data items or data structures were passed as parameters Results were either passed back as parameters or as a return value 6-6
Image of page 6
Image of page 7
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern