As I know it is a function. And If you want to make it work. You shall define a constructor function in your class. For exp.
// C++ is sensitive for the difference of 'A' & 'a' (I don`t how to express this well)
#include <iostream>
using namespace std; // avoid the unconvenient of the type like "std::cout ..."
class MyClass // "Class" is not functioning.(use "class")
{
public: // under public the function & parameter can be used.
MyClass( int i ); // declaration of the constructor.(also you can overload it by using copy constructor)
private: // under private the function & parameter can`t be seen.(make sure it won`t be used by out members)
int a; // define a private for this class only. I added it.
};
// the functions of constructor
MyClass::MyClass( int i )
{
a = i;
}
int main()
{
MyClass b(); // I deleted "MyClass a" as my constructor declaration is not MyClass();(I mean it is not functioning)
MyClass d( 3 ); // I added this. You can debug here to see the value changes(remember to add a breakpoint)
}
Add this above in one of you .cpp file and you will see clearer.
@c90a78, MyClass b(); // I deleted "MyClass a" as my constructor declaration is not MyClass();(I mean it is not functioning)
buddy, what are you trying to say?
is invalid.
And if I want to make it valid. Constructor
MyClass();
is needed.
I`m new here & I`m also new in C++. I apologized that I answered your question in such a paradoxical way. (I`m really not good in expressing as English is not my nature language.)