i made a class as A2dd and i want an output by printf from gx+gy but i dont see as the output. i want that the output which is from the class be shown in the console (since i use eclispe). but i just see "hello world".
where is the problem?
Main:
#include <iostream>
#include <stdio.h>
#include "A2dd.h"
using namespace std;
int main( )
{
A2dd(5,2);
int getsum();
cout << "hello world" << endl;
return 0;
}
header:
#ifndef A2DD_H_
#define A2DD_H_
class A2dd {
public:
int gx;
int gy;
A2dd(int x, int y);
int getsum();
};
#endif /* A2DD_H_ */
A2dd:
#include <stdio.h>
#include "A2dd.h"
using namespace std;
A2dd::A2dd(int x, int y)
{
gx = x;
gy = y;
}
int A2dd::getsum()
{
printf ("%d" , gx + gy);
return 0;
}