Classes, Objects, Functions and Constructors

0 Daniel Rivera · May 15, 2015
Can you please help me understand classes, functions, objects and constructors? 
At least send me a link that will explain it really good. 

Post a Reply


Oldest  Newest  Rating
0 K D · May 16, 2015
this is a video for java but classes in c++ are exactly the same. The only real difference is the syntax and grammar but it does the same type of thing...
its not how to build them but what they are and how they are used.

an object would be just a variable made of that class.  In fact the string not the character arrays but the data type string is an object...

the best way i can describe a function is its a way of being able to re-use code in a program with out you having to rewriting the same code over and over... 
It can take parameters but it doesnt have to.. functions can also return a single value but they do not have to.  How ever if the function is defined in the way that says it returns a value it MUST return a value of the specified datatype... A functions (in C, C++, Python, ect... except for Go(also known as Golang)) CAN ONLY return ONE value "at a time".  This does not mean that you cant have a multiple return statements.  But the must be conditional so they must be controlled by a condition saying which return statement will be triggered.  I really hope that was a good explination...

a constructor is a function that is the function called when an object is made of that class.  There are three types of constructors. The ones most used are the Default constructor which takes no parameters and is automatically called.  The second is the Initialize constructor which does take parameters and also sets variables in the class. The third is well weird it makes a copy of an already existing object and is called the Copy constructor.  The parameter for it is an object of its self.

Bucky could explain it much better then i can so i would highly suggest watching his tutorials on them.
Classes and Objects:

I really hope this helps...
0 Troy Jones · May 16, 2015
"Please help me understand how to program."
  • 1



Used in many types of software including music players, video games, and many large scale applications.

Bucky Roberts Administrator