Estudo de C++ Flashcards
Aprender C++
Dereference operator
Give access to real valor on the variable
Reference operator
Give access to memory address
Keyword New
Creates and initializes objects with dynamic storage
Keyword Delete
Erase variables after use
Struct
structure for grouping variables, from different types
Classes
Extension of struct concept, can have functions
Data in structs
Atributes
Functions in Classes
Also called methods
Object
Takes attributes and methods from classes
Object
We use it to access what is in classes
Default classes
Everything after a declared class and before a specifier is PRIVATE
Scope operator
::
Scope operator definition
To show that a function is a implementation from a member from a class, not a global function
Constructor
Special method called when a new object is created
Using Constructor
Need to have the same name as the classes and no return valor, even VOID
Destructor
Called when an object is destroyed(when a function ends or when we use DELETE
Using Destructor
Need the same name as the class and a precede “~”
Destructor advantages
Good for memory releasing
Common practices in C++ with classes
Creating two separated files
pragma once
Preprocessor directive to include the header once, regardless how many times he has been imported
Declaring a classes as STATIC
We don’t need to instantiate a classes for using it
Static class example
“static int math::pow();”