Issue with Class in Dev C++

so this is the program

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <iostream>
using namespace std;

 
class Human{
    char *name;
    int age;
    float height;
    float weight;
    
public:
Human (char *N, int A, float H, float W);
void Prints () const;
void Set (char *N, int A, float H, float W);
};

int main(){
Human myObj;
myObj.Prints();
myObj.Set("Ronaldo", 28, 185.0, 85.0);
myObj.Prints();
}


I never get it run on Dev C++. but my friend report it. that it work in Xcode.

any idea why?
This should not work. You need to pass 4 arguments to the Human constructor on line 18.
I try that one also. never got it worked. do you have any working code that I can try?
The constructor and other functions need to be defined so that the values sent in actually get assigned to the data members. Right now there are just prototypes.
Topic archived. No new replies allowed.