// Example program
#include <iostream>
class Data {
public:
Data()
{
for (int i = 0; i < 5; i++)
{
data[i] = 13 * (i*i); // some number
pointers[i] = &data[i];
}
}
int* pointers[5]; // the array of int pointers
private:
int data[5]; // the actual data we're referencing through the pointers. You can do it your own way to what suits your needs.
};
int main()
{
Data data;
for (int i = 0; i < 5; i++)
{
std::cout << "Data at address " << reinterpret_cast<void*>(data.pointers[i]) << " == " << *data.pointers[i] << std::endl;
}
int a = 42;
data.pointers[2] = &a;
}
#include <iostream>
class Age {
public:
Age(int input)
{
m_Age = input;
}
private:
int m_Age;
};
int main()
{
for (int i = 0; i < 50; i+=5)
{
Age *a = new Age(i);
std::cout << a << std::endl;
}
std::cin.get();
return 0;
}