C++ Review Topics
View Paper
ESSAY DETAILS
Words: 3282
Pages: 12
(approximately 235 words/page)
Pages: 12
(approximately 235 words/page)
Essay Database > Science & Technology > Computers and Cybernetics
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
Sign up for EssayTask and enjoy a huge collection of student essays, term papers and research papers. Improve your grade with our unique database!
showed first 75 words of 3282 total
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
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