Hello
I'm learning c++ and it is clear to me how to add information to header
file about functions. But what about class and class functuons?
If i have:
1. main.cpp
#include "myHeader.h"
int main(){
myClass test;
test.nr=1;
test.printnr();
return 0;
}
2. myClass-source.cpp
#include other stuff...
#include "myHeader.h"
using namespace std;
class myClass {
Public:
int nr;
void printnr(){
cout<<this.nr<<endl;
}
}
3. myHeader.h
?????????
myClass::void printnr(); --I guess ...
but what about class file?
So my questions are:
a) How myHeader.h file should look like that it worked?
b) Because i come from Java - is it correct way to make instance of
class, or i should call a "new" operator like that:
myClass test=new myClass();
c) What if myClass has a constructor - what should be included to header
file?
Thanks,
Juhan.