vahid javani
شنبه 22 مهر 1391, 10:51 صبح
درود
اگه امکان داره راهنماییم کنید:
//poynomial.cpp
#include"poynomial.h"
poly1::poly1(int deg)
{
if(deg>0)
degree=deg;
else
{
cout<<"Error";
exit(1);
}
int *coef=new int [degree+1];
}
//poynomial.h
#ifndef POLYNOMIAL_H
#define POLYNOMIAL_H
#include<iostream>
using namespace std;
class poly1
{
public:
poly1(int);
int degree;
int *coef;
};
#endif
ولی وقتی از تابع سازنده خارج میشه حافظه رو پاک میکنه.
از پاسختون متشکرم!
اگه امکان داره راهنماییم کنید:
//poynomial.cpp
#include"poynomial.h"
poly1::poly1(int deg)
{
if(deg>0)
degree=deg;
else
{
cout<<"Error";
exit(1);
}
int *coef=new int [degree+1];
}
//poynomial.h
#ifndef POLYNOMIAL_H
#define POLYNOMIAL_H
#include<iostream>
using namespace std;
class poly1
{
public:
poly1(int);
int degree;
int *coef;
};
#endif
ولی وقتی از تابع سازنده خارج میشه حافظه رو پاک میکنه.
از پاسختون متشکرم!