Hi again guys, (and thanks matt for answerme, I´ll to probe it and later I´ll say you)....
I have another trouble....
in the next program, my method "reserva" doesn´t make nothing!!
I wonder if u know why....
thanks again.
rick
----------------------------
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <iostream.h>
#include <fstream.h>
#include <conio.h>
struct part
{
float v1, v2;
};
struct hoyo
{
float v1,v2,v3;
};
template <class T> class base
{
public:
T *vector;
T **vector2;
T *cadena;
base ()
{
};
void Poner()
{
}
void Imprimir()
{
};
};
template <class T>
class derivada_partublic base<T>
{
public:
part valores;
// T *vector;
derivada_part(part vals)
{
// vector = new (other)T;
valores.v1=vals.v1;
valores.v2=vals.v2;
};
void Imprimir()
{
cout << "esta marinola es para probar... valores de particula"
<< "\nvalores " << valores.v1 << "," << valores.v2;
};
void reserva () {}
};
// the next function doesn´t work :-(
template <class T> void derivada_part<T>::reserva()
{
cout << "\naqui si entro...!!!!!\n";
};
template <class T>
class derivada_hoyoublic base <T>
{
public:
hoyo valores;
T *vector;
derivada_hoyo(hoyo vals)
{
valores.v1=vals.v1;
valores.v2=vals.v2;
valores.v3=vals.v3;
};
void Imprimir()
{
cout << "\nesta marinola es para probar... valores de hoyo"
<< "\nvalores " << valores.v1 << "," << valores.v2 << ","
<< valores.v3;
};
}
void main (void)
{
part temparti;
hoyo temphoyo;
derivada_part <void> *ptr_obj;
clrscr();
cout << "ejemplo de las clases de templates" << endl << endl;
// clases
temparti.v1=1.5;
temparti.v2=2.5;
temphoyo.v1=4.5;
temphoyo.v2=4.5;
temphoyo.v3=4.5;
derivada_part <part> term_part1(temparti); //crea el objeto particula...
term_part1.Imprimir();
term_part1.reserva();
term_part1.reserva();
term_part1.reserva();
derivada_hoyo <hoyo> term_hoyo1(temphoyo);
term_hoyo1.Imprimir();
getch();
}