(C++) Instance

February 24, 2017 · View on GitHub

 

 

 

 

 

(C++) Instance

 

When you construct a variable of a certain data type, you are creating an instance (also: object) of that data type.

 

In the code below an int called 'x' is instanciated.

 


int main() {   int x = 0; }

 

 

 

 

 

Advice

 

 

 

 

 

 

References

 

  1. Bjarne Stroustrup. A tour of C++. 2014. ISBN: 978-0-321-958310. Chapter 11.7.5, page 131: 'Use unique_ptr to refer to objects of polymorphic type'
  2. Bjarne Stroustrup. A tour of C++. 2014. ISBN: 978-0-321-958310. Chapter 11.7.6, page 131: 'Use shared_ptr to refer to shared objects'