Hullo hullo
I've just got a quick question about classes, and I ask you to bear with me cause this is the first time I'm trying to learn about them
Here's some sample code:
Now, I realise that there may be better ways to right such code, but here's what I'm wondering about...Code:TheClass.h Class MyClass { public: InitialiseX(int Number); private: int x; }; TheCode.cpp include "TheClass.h" MyClass::InitialiseX(int Number) { x = Number; }
1) First of all, are there any errors in what I wrote up there?
2) Can I use "MyClass.x ="
3) My main question, can I move the "MyClass::InitialiseX" function dealey into the .h file? That way, it's a tad more organized. If so, are there any drawbacks to this?
Thanks for any insight![]()



LinkBack URL
About LinkBacks



