Download presentation
Presentation is loading. Please wait.
Published byAshlie Pierce Modified over 8 years ago
1
C++ Objects and Scope
2
Important Definitions Class Access and Visibility Encapsulation Unified Modeling Language (UML) Constructor Destructor Scope
3
Class Definitions A Class is a blueprint for an object. It holds a recipe for making/using an object
4
Access Specifies Items inside of a class can be set to be accessible only by objects of that class or by anyone A public member can be accessed (using an object of the class1) anywhere in a program that #includes the class definition file. A protected member can be accessed inside the definition of a member function of its own class, or a member function of a derived class. A private member is only accessible by member functions of its own class.
5
Encapsulation Encapsulation is the term used to describe how an object contains its own data and functions for manipulating that data. Encapsulation lets an object be 'self- sufficient'
6
Unified Modeling Language (UML) A graphical way of seeing a class and its associated data elements and methods/functions. Figure from course text
7
Constructors Every object when its created runs a 'constructor' function A class can have different constructors at the same time based on different needs
8
Destructors Every object when it is destroyed runs a 'destructor' function Destructors keep memory clean They can handle IO operations (closing files or ports)
9
Scope Scope™ is a mouthwash Scope is where variables and function exist in code. Something 'out of scope' can not be accessed or manipulated The main method of defining scope is { and }
10
In Summary Classes describe objects Classes show what is 'encapsulated' in an object All classes have constructors and destructors.
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.