#include <iostream>
#include <string>
using namespace std;
class Dog
{
public:
Dog(string name)
{
dogs = new string[1];
dogs[0] = name;
}
~Dog()
{
delete [] dogs;
dogs = NULL;
}
void AddDog(string name)
{
int current_size = (sizeof(dogs) / sizeof(string));
int new_size = current_size + 1;
//Now I want to change the arrays size
string * temp = dogs;
dogs = new string[new_size];
for(int i = 0; i < current_size; i++)
{
dogs[i] = temp[i];
}
delete [] temp;
temp = NULL;
//Now I have copied the original data into a new array of a bigger size
//Now I am going to add the new dog
dogs[new_size-1] = name;
for(int i = 0; i < new_size; i++)
{
cout << "Dogs name: " << dogs[i] << endl;
}
}
private:
string * dogs;
};
int main()
{
Dog Pack("Rufus");
Pack.AddDog("Hannah");
return 0;
}
float * verts;
verts = new float[300000];
//fill with data
delete [] verts;
verts = new float[500000];
//fill with different data
void (*FunctionToBeCalledLater) ();
Then later they assign:
FunctionToBeCalledLater = &insert_function_here
Then use:
(*FunctionToBeCalledLater)();
//or
FunctionToBeCalledLater();
Copyright © 2026, NextGenUpdate.
All Rights Reserved.