Home
Flashcards
Preview
CPSC - Object Oriented Programming
Home
Get App
Take Quiz
Create
Automatically remove your image background. Try it now!
https://remove-image-background.com
How are objects defined?
By their attributes
By operations than can be performed on them
Object
A real/physical or imaginary thing
E.g Person, Bank Account, Address etc
Class
Set of objects with the same properties
Forms the blueprint of an object
Client
Creates class objects and manipulates them with public operations
Accessor
Can only
view
values of data members
Modifier
Can
view
and/or change data members
Constructor
Used to build and initialize an object
Types of constructor
Default:
Data members initialized with default values
Constructor with arguments
What happens if no constructor is included?
Data members are not initialized
Operators that always work with user-defined objects
Assignment "=" - Assigns each data member of an object
Dot"." - Used to access class members
Two parts of a class
Interface (.h)
Implementation (.cc)
Struct/
record
A class where all data members are declared public
Compiler directive, to prevent excess copies/code
// In the header file
#ifndef CLASSNAME_H
#define CLASSNAME_H
...
...
#endif
What is, "::"
The scope resolution operator
Used as a prefix to each function name in the header
Accessor methods should be...
constant (const)
const className& object //in header and parameters
static members
Are the same across all instances of a class
Usual members are limited to each instance
Declaring, and using static objects
Declaration
: static member
Accesssing
: className::member
where member refers to a method or datamember
Automatically remove your image background. Try it now!
https://remove-image-background.com
Author
Ant
ID
328322
Card Set
CPSC - Object Oriented Programming
Description
CPSC
Updated
2017-02-11T02:45:36Z
Show Answers
Home
Flashcards
Preview