User Tools

Site Tools


cpp:vector_overloading

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
cpp:vector_overloading [2021/05/24 07:29]
gthanos
cpp:vector_overloading [2021/05/24 07:33]
gthanos
Line 6: Line 6:
 #include <cstdlib> #include <cstdlib>
 using namespace std; using namespace std;
 +
 +#ifndef _VECTOR_HPP_
 +#define _VECTOR_HPP_
  
 class Vector { class Vector {
Line 23: Line 26:
   void print() const;        // print vector values to standard output   void print() const;        // print vector values to standard output
 }; };
 +
 +#endif
 </code> </code>
  
Line 99: Line 104:
   Vector v(5);   Vector v(5);
   v.valueAt(0) = 2;  v.valueAt(1) = 3;   v.valueAt(0) = 2;  v.valueAt(1) = 3;
-  v.valueAt(2) = 4;  v.valueAt(3) = 5;  v.valueAt(4) = 6; +  v.valueAt(2) = 4;  v.valueAt(3) = 5;  v.valueAt(4) = 6
 +  v.print();
 } }
 </code> </code>
cpp/vector_overloading.txt · Last modified: 2021/05/24 06:35 (external edit)