Originally posted by salvelinus
You may ... you're trying first.
I tried but mistakes comes~
here is the declaration(which in myClass.h) of myClass:
PHP Code:
class mankind
{
public:
mankind(string,int);
private:
string name;
int age;
};
and this is for the relative definations(in the file myClass.cpp):
PHP Code:
#include <iostream>
#include <string>
mankind :: mankind(string s, int t)
{
name=s;
age=t;
cout << "your name is: " << name << endl;
cout << "your age is: " << age << endl;
}
at last, I want to invoke myClass in another files, the code is as follows:
#include <iostream>
#include <string>
#include "myClass.h"
void main()
{
mankind black("black",189);
}
that'all, I write the codes with my comprehension. but there is still something wrong, I couldnt figure it out at once, what's that please ???