#include <iostream>
using namespace std;
class test {
public:
test(int one, int two); //concustructor taking two arguments.
private:
}; one (1, 1)
//one will be created as an ojbect -- but as now the compiler will give me an error
void main()
{
}
Is there a way when this class has been defined that I can create a object with it so the user does not have to?
By that I mean the user will use the class methods, but the object deprived from the class test will have been already created.
So in main I do not have to declare say test one. Sorry I can't be more clearer on this but it is the same way you can do it with structures.
Question
Genesi
#include <iostream> using namespace std; class test { public: test(int one, int two); //concustructor taking two arguments. private: }; one (1, 1) //one will be created as an ojbect -- but as now the compiler will give me an error void main() { }Is there a way when this class has been defined that I can create a object with it so the user does not have to?
By that I mean the user will use the class methods, but the object deprived from the class test will have been already created.
So in main I do not have to declare say test one. Sorry I can't be more clearer on this but it is the same way you can do it with structures.
Thanks.
Link to comment
Share on other sites
8 answers to this question
Recommended Posts