22/03/2012, 21:09
|
| | Fecha de Ingreso: diciembre-2011
Mensajes: 16
Antigüedad: 13 años, 1 mes Puntos: 0 | |
Instanciar array ayudaa HOLA QUE TAL... UNA PREGUNTA... SUPONGAMOS QUE TENGO UNA CLASE MICLASE Y QUIERO HACER UN ARREGLO DE ESE TIPO DE CLASE (UN ARREGLO DE MICLASE)
ASI ES COMO LO ESTOY HACIENDO
class MICLASE
{
public:
int N;
MICLASE(int n)
{
N=n;
}
void prueba()
{
cout<<N<<endl<<endl;
}
};
int main(){
MICLASE* arreglo[t];
arreglo[t]=new MICLASE(n);
//suponiendo que ya pedi n, y todo esta bien
arreglo[2]->prueba();
return 0;
}
LO QUE QUIERO QUE HAGA ES QUE ME IMPRIMA EL ATRIBUTO N QUE SE ENCUENTRA EN EL ELEMENTO 2 DEL arreglo
pero no me funciona. si alguien me puede ayudar gracias..! |