Ok sombody please, can expain in clear terms what is , and how it works????
the book said that its created by the user ??? mmm but I still confused.
Ill be so grateful
Thx in adv.
regards,
Abyss.
Ok sombody please, can expain in clear terms what is , and how it works????
the book said that its created by the user ??? mmm but I still confused.
Ill be so grateful
Thx in adv.
regards,
Abyss.
Last edited by abyssphobia; 08-17-2004 at 08:49 PM. Reason: because i didnt finished writting my question
Have I crossed the line?
objects are just what objects are. Like a pen is an object. so if you wanted to make a pen class you would do something like this
All you have to think about for objects is what really real world object can do and some comptuer object tooCode:class pen { public: void setInk(const int setInkAmount); int getInk(); void penClick(); private: int inkAmount; }
Woop?
A collection of variables and functions, pretty much...
Code:#include <iostream.h> int var; int test(); int main() { cout << "Please input your language:\n 1. C (C,C++,C#)\n 2. VB\n 3. Other\n"; cin >> var; return test(); } int test() { if(var == 1) { cout << "Y0u 4r3 t3h 1337\n"; system("PAUSE"); return main(); } else if(var == 2) { cout << "N00B3R!\n"; system("PAUSE"); return main(); } else if(var == 3) { cout << "You were not thought of.\n"; system("PAUSE"); return main(); } else { return 0; }}
C++ is an Object-Oriented language. That means that it gives a lot of support for thes collection of data and functions. You can define a type of object, make "instances" of those object, have certain objects inherit properties from others, etc... It's lots of fun...
so a class is "like" a type (e.g. int, float, double) and an object is "like" a variable. So you would declare (make an instance ... whatever) an object like so:
which is "like" saying:Code:MyClasse myObject
another example with classes and objects:Code:myType myVariable
Code:pen this_is_now_a_pen
Last edited by ryan_germain; 08-18-2004 at 06:37 AM.
There is not the slightest indication that [nuclear energy] will ever be obtainable. It would mean that the atom would have to be shattered at will.
-Albert Einstein, 1932