i have the following class in C++:
class point {int x,y; public: point(int abs=0,int ord=0.0) {x=abs;y=ord;} };
how can i initialize the values x, y of a "point" table, in a main program ?
void main() {int i; point curve[5]={7,4,2,3,5}; // this instruction only initialize "x" values of the table "curve"; how can i do for "y" values ? }
thanks.
Use a constructor
class Bhad { public: // Constructor Bhad(double mem1 = 1.0, double mem2 = 1.0, double mem3 = 1.0);
// Function double Bhadn();
private: double mem 1; double mem 2; double mem 3; };
#endif
Log in to post a comment.
i have the following class in C++:
class point
{int x,y;
public: point(int abs=0,int ord=0.0)
{x=abs;y=ord;}
};
how can i initialize the values x, y of a "point" table, in a main program ?
void main()
{int i;
point curve[5]={7,4,2,3,5}; // this instruction only initialize "x" values of the table "curve"; how can i do for "y" values ?
}
thanks.
Use a constructor
class Bhad
{
public:
// Constructor
Bhad(double mem1 = 1.0, double mem2 = 1.0, double mem3 = 1.0);
// Function
double Bhadn();
private:
double mem 1;
double mem 2;
double mem 3;
};
#endif