learning about object

Page 1 of 1

3 Replies - 334 Views - Last Post: 27 September 2013 - 11:34 AM Rate Topic: -----

#1 BeHappY  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 13-September 13

learning about object

Posted 27 September 2013 - 09:21 AM

what is the job of the object in c# and what is the difference between the object and the constructor ??
Is This A Good Question/Topic? 0
  • +

Replies To: learning about object

#2 macosxnerd101  Icon User is offline

  • Self-Trained Economist
  • member icon




Reputation: 10390
  • View blog
  • Posts: 38,455
  • Joined: 27-December 08

Re: learning about object

Posted 27 September 2013 - 09:25 AM

It sounds like you haven't done any reading on OOP. You should check out tlhIn`toq's tutorial on classes and objects.
Was This Post Helpful? 0
  • +
  • -

#3 Rhino1111  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 96
  • View blog
  • Posts: 220
  • Joined: 28-August 13

Re: learning about object

Posted 27 September 2013 - 10:28 AM

an Object is a user defined data structure "Type". When you are writing programs you'll always need to model some kind of real world interpretation of something, in other words, a real world "object". For example, maybe your writing a business application that needs to model a "Person". You would create a "class" called Person, and put whatever data is relevant to a "Person" in that class, such as age, address, etc. You can also include any "actions"(referred to as Methods) that are relevant to a person in that class, such as a Work() method. A class is a blueprint for an object, the same way a design plan for a house is a blueprint for the actual house.

the "new" keyword is used to actually build the object, or more commonly referred to as "instantiating" an object. You can't do anything with the blueprints other than build what it defines. When you instantiate an object, the constructor is the first thing that runs, this is usually used for passing in values to the fields for initialization, but isn't only limited to that, for example, you can also instantiate other objects inside a constructor, if your class holds other user defined types(references to other classes), which in turn calls their constructors also.

Objects are a very broad topic, and nobody will be able to explain everything to you in this topic. They don't call it an Object Oriented language for no reason, think about that. Object. Oriented. That means the language is oriented around the use of objects. You're best bet is to pick up some "C# Fundamentals" book, as they usually spend quite a few chapters around the concepts of OOP (such as classes, inheritance, etc).

MDSN: http://msdn.microsof...y/ms173110.aspx

This post has been edited by Rhino1111: 27 September 2013 - 10:40 AM

Was This Post Helpful? 0
  • +
  • -

#4 Curtis Rutland  Icon User is online

  • (╯□)╯︵ (~ .o.)~
  • member icon


Reputation: 4436
  • View blog
  • Posts: 7,707
  • Joined: 08-June 10

Re: learning about object

Posted 27 September 2013 - 11:34 AM

Closed as a zero-effort question. Please put in some research effort before asking these kinds of questions.

If you have any questions, you can send me or any other team member (dark blue and green badges) a private message.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1