My question is how to declare an array without specifying the length and then instantiate it in the constructor method by specifying the quantity.
To enter the context, I leave the following example.
#ifndef GRAFO_H
#define GRAFO_H
#include <iostream>
#include <string>
using namespace std;
class grafo {
public:
grafo();
grafo(const grafo& orig);
virtual ~grafo();
private:
int num_pla;
string nom_pla[]; // Declaración sin especificar el tamaño del array.
};
#endif /* GRAFO_H */
Now what I'm looking for is to instantiate it in the constructor of the class and specify the length as the following example in JAVA.
String b[] = new String[9];
Now, is this possible? If it is not; What other form would you recommend, to solve?