KingOfJava
Programmer
//Example.cpp
// MAIN FILE : It make use of Test.h and Test.cpp
#include "Test.h"
int main(){
Test *t = new Test("KingOfJava"
cout << t->getMessage() << endl;
}
//++++++++++++++++++++++++++++++++++++++++
//Test.h
#include <iostream>
#include <string>
using namespace std;
class Test{
string msg;
public:
Test(string s);
string getMessage();
};
//++++++++++++++++++++++++++++++++++++++++
// Test.CPP
#include "Test.h"
Test::Test(string s){
msg = s;
}
string Test::getMessage(){
return msg;
}
//+++++++++++++++++++++++++++++++++++++++++++++++++
I am new to CPP and I wanted to creat an example of Lib file.
I have created a header file I wanted to put it in Include directory of Borland comp
Test.cpp I wanted to creat an object file out of it. And wanted to put it in Lib directory.
And I wanted to write an example program which make use of them.
Please help how to do them.
Thanx in advance,
Regards,
// MAIN FILE : It make use of Test.h and Test.cpp
#include "Test.h"
int main(){
Test *t = new Test("KingOfJava"
cout << t->getMessage() << endl;
}
//++++++++++++++++++++++++++++++++++++++++
//Test.h
#include <iostream>
#include <string>
using namespace std;
class Test{
string msg;
public:
Test(string s);
string getMessage();
};
//++++++++++++++++++++++++++++++++++++++++
// Test.CPP
#include "Test.h"
Test::Test(string s){
msg = s;
}
string Test::getMessage(){
return msg;
}
//+++++++++++++++++++++++++++++++++++++++++++++++++
I am new to CPP and I wanted to creat an example of Lib file.
I have created a header file I wanted to put it in Include directory of Borland comp
Test.cpp I wanted to creat an object file out of it. And wanted to put it in Lib directory.
And I wanted to write an example program which make use of them.
Please help how to do them.
Thanx in advance,
Regards,