C++ Review Topics
Title: C++ Review Topics
Category: /Science & Technology/Computers and Cybernetics
Details: Words: 3282 | Pages: 12 (approximately 235 words/page)
C++ Review Topics
Category: /Science & Technology/Computers and Cybernetics
Details: Words: 3282 | Pages: 12 (approximately 235 words/page)
C++ fully supports object-oriented programming which includes the following:
Encapsulation is the property of being a self-contained unit. With encapsulation we can accomplish data hiding. Data hiding is the highly valued characteristic that an object can be used without the user knowing or caring how it works internally. C++ supports the properties of encapsulation through the creation of user-defined types, called classes.
Inheritance allows for the extension of an existing type. The new subclass derives
showed first 75 words of 3282 total
You are viewing only a small portion of the paper.
Please login or register to access the full copy.
Please login or register to access the full copy.
showed last 75 words of 3282 total
data
private:
unsigned int itsAge;
unsigned int itsWeight;
};
The above class has five public methods. There are accessor functions GetAge and SetAge for itsWeight. These accessor functions set the member variables and return their values.
The public member function Meow() is not an accessor function--it doesn't get or set a member variable.
To set Frisky's age, you would pass the value to the SetAge method as in:
Cat Frisky;
Frisky.SetAge(5); //uses public accessor function