#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.
Around 68% of developers are now using AI to generate code during development, and some experts are saying that a single developer using AI tools can now do the work of an entire team of 4 to 5 engineers.
According to Figma's State of the Designer 2026 report, 72% of designers now use generative AI in their workflows and 91% say it improves the quality of their work, not just their speed.
But does this mean web developers and designers are becoming less relevant, or are they simply evolving into a different kind of role?
Would love to hear from developers and designers here has AI made your job easier, or do you feel threatened by how fast these tools are improving
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
https://www.neowin.net/forum/topic/220912-creating-a-object-from-a-class-automatically/Share on other sites
8 answers to this question
Recommended Posts