8-Classes - / Classes - Object Oriented Programming / / / /...

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

View Full Document Right Arrow Icon
// Classes - Object Oriented Programming // A class is a group of related data and functions that operate // on that data. Creating a class is very similar to // creating a struct, we are making a new type, when // dealing with classes, we use objects of this type. #include <iostream> using namespace std; // // Class definition class Student { // // Access Level private: // All parts of the class from the private label until either // the end of the class or until the next Access // modifier will be private. This means that the functions // and variables (members) cannot by altered outside of // the class itself (normally speaking) int ID; int age; // public access level works as the interface to the class // object. Whomsoever can see the object itself can also // see the public features of the class public: // The following function is called a constructor. The job // of the constructor is to build the object and set its // members to the appropriate initial values. Building // sometimes includes allocating memory, setting up
Background image of page 1

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

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 10/05/2011 for the course CS 37 taught by Professor Glenncuevas during the Summer '09 term at Irvine Valley College.

Page1 / 2

8-Classes - / Classes - Object Oriented Programming / / / /...

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

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