Hi,
I have been programming C# for some time, and i recently learned about constructors and objects, but didn't fully understand.
Can anyone please help me understand this, and please spell it out. I have tried googling it, but couldn't really find anything, that made me understand it.

  • What is a constructor?
  • What is a object?
  • When should i use a constructor?
  • When should i use a object?

You said you have been programming in C# for some time.
Did you manage to write a "Hello world" program? Great!
What else did you achieve in C#?
I'm not gonna reinvent the wheel here, I googled What is a constructor C# the first webpage is this one
If there is anything in there you don't understand, please come back and ask a question.
We will try to help.
See you soon.

commented: I'm seeing many folk dismiss such research. Maybe they are taught in school to not use research tools? +15

An object is a combination of some data and some methods that together represent some kind of entity eg an employee, an invoice, an IP address etc etc.
Constructors are special methods that are part of the object's definiton and are responsible for initialising the state of any new object when it is created.

You define an object when you want to represent something (see above) in your program. That definition includes the definition of one or more constructors if you need to initialise new objects to some particular value or state.

You say,

I have been programming C# for some time,

and

i recently learned about constructors and objects

Unless 'some time' is 'under an hour', these two statements are contradictory.

If you are new to C# programming, either learning it on your own or as a student in a course on the topic, we will understand, and be happy to help. However, if you try to present yourself as experienced in something when you aren't, that sets up expectations which will make it harder for us to help - we won't be able to judge what kind of explanation to give.

And if you try to pass off homework problems as something else, well, that's a Problem, as it is a direct violation of the Daniweb Forum Posting Rules, specifically this one:

  • Do provide evidence of having done some work yourself if posting questions from school or work assignments

We can forgive it once, as you are a new member who isn't clear on the rules, but please don't try it again.

commented: +1 for putting it nicely. +15

This looks more of a school asignment.
Also

I have been programming C# for some time, and i recently learned about constructors and objects, but didn't fully understand.

indeed looks like a contradictory statement.

The questions you've put here are the basic understanding of OOP, and are not tied specifically to C#. I'd advide you take a look over the concepts behind OOP.

I also found this Click Here link, of an online free course from Udemy, which tackles the Basics of OOP with C# (and yes, it covers your questions, 2nd module).

Hope this helps.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.