will u explain more about the class
what is the main function of class in c++?when we have to use class ?
Collapse
X
-
Please start reading the OOP concept first. You will get a clear picture.
Google and find more about classes..
Regards
Dheeraj Joshi -
There are no classes in C++.
All C++ has are structs.
The C++ "class" is implemented as a struct.
This:
is exactly the same as:Code:struct MyStuff { private: int data; public: void SetData(int); int GetData(); ///etc... };
That is, as long as you specify our member access as public/private/protected, there is no difference between a struct and a class.Code:class MyStuff { private: int data; public: void SetData(int); int GetData(); ///etc... };
There is one difference when you do not specify the member access. The default access for a struct will be public whereas the default access for a class will be private.
I suggest you expand your research into how to implement encapsulation.Comment
Comment