Page 3 of 4

Re: Confusion

Posted: Mon Jan 24, 2011 8:27 pm
by Ginto8
What I believe you're looking for is an entire meta-object system, not a normal OOP paradigm. However, you might want to look into constructors and object/variable declarations, because they might just be intrinsic and necessary parts of a programming language that supports OOP.

Re: Confusion

Posted: Mon Jan 24, 2011 9:43 pm
by THe Floating Brain
OMG TY!!!! I have only skimmed a little throught the doc but it looks promising and I will fully read it later. THANK YOU SO MUCH!!!

Re: Confusion

Posted: Tue Jan 25, 2011 7:01 am
by Ginto8
... what? I wasn't suggesting a meta-object system, they're heavy, clunky and just overall unnecessary for most things. I was just saying that, in order to do what you want, you need one. However, a better idea is just to use a constructor.

Re: Confusion

Posted: Tue Jan 25, 2011 7:54 am
by N64vSNES
Ginto8 wrote:However, a better idea is just to use a constructor.
This^ ;)

Re: Confusion

Posted: Tue Jan 25, 2011 6:08 pm
by THe Floating Brain
Im trying to invision as to how to do that with a constructor. Or are you refering to some kind of OO design?

Re: Confusion

Posted: Tue Jan 25, 2011 7:21 pm
by Ginto8
THe Floating Brain wrote:Im trying to invision as to how to do that with a constructor.

Code: Select all

Dude man(cow, calf, moose, earlobe);
THe Floating Brain wrote:Or are you refering to some kind of OO design?
no, I'm talking about a basic part of the language.

Re: Confusion

Posted: Tue Jan 25, 2011 9:53 pm
by THe Floating Brain
Ginto8 wrote:
THe Floating Brain wrote:Im trying to invision as to how to do that with a constructor.

Code: Select all

Dude man(cow, calf, moose, earlobe);
THe Floating Brain wrote:Or are you refering to some kind of OO design?
no, I'm talking about a basic part of the language.
Your diagram us not telling me much, you cant have a space in your class name is this a function is dude from a template or from a inherited class amongst calf, moose, earlobe? (your digram is confusing.
Ginto8 wrote:
THe Floating Brain wrote:Or are you refering to some kind of OO design?
no, I'm talking about a basic part of the language.
Just making sure. :-)

Re: Confusion

Posted: Wed Jan 26, 2011 12:08 am
by XianForce
THe Floating Brain wrote:
Ginto8 wrote:
THe Floating Brain wrote:Im trying to invision as to how to do that with a constructor.

Code: Select all

Dude man(cow, calf, moose, earlobe);
THe Floating Brain wrote:Or are you refering to some kind of OO design?
no, I'm talking about a basic part of the language.
Your diagram us not telling me much, you cant have a space in your class name is this a function is dude from a template or from a inherited class amongst calf, moose, earlobe? (your digram is confusing.
In his example, "Dude" is the class, "man" is name of the instance, and "cow, calf, moose, earlobe" are the parameters for the constructor. When you create a class, you can override the constructor to perform other operations, so like:

Code: Select all

class Dude
{
public:
    Dude() {
        //do stuff here...
    }
};
But you can also give parameters to it:

Code: Select all

class Dude
{
public:
    Dude(SomeOtherClass instanceOfSomeOtherClass) {
        //Do stuff here
    }
};
What Ginto showed was a simple example of the syntax for the use of a constructor... If you don't recognize that, you in all likelihood do not know C++ as well as you say (or even think) you do. I'd STRONGLY suggest that you learn how to use classes a bit more effectively...

Re: Confusion

Posted: Wed Jan 26, 2011 7:52 am
by Ginto8
THe Floating Brain wrote:
Ginto8 wrote:
THe Floating Brain wrote:Im trying to invision as to how to do that with a constructor.

Code: Select all

Dude man(cow, calf, moose, earlobe);
THe Floating Brain wrote:Or are you refering to some kind of OO design?
no, I'm talking about a basic part of the language.
Your diagram us not telling me much, you cant have a space in your class name is this a function is dude from a template or from a inherited class amongst calf, moose, earlobe? (your digram is confusing.
It wasn't a declaration of a class; it was a variable declaration. Presuming that Dude is a class with a constructor that takes the types of cow, calf, moose and earlobe as parameters (they're just random variables), then man is initialized as such.

Obviously you have not learned enough about types and classes. Look here. If that's too confusing, or you have other issues, try starting at the beginning.

Re: Confusion

Posted: Wed Jan 26, 2011 8:10 am
by adikid89
Ginto8 wrote:Obviously you have not learned enough about types and classes. Look here. If that's too confusing, or you have other issues, try starting at the beginning.
Yes! http://www.cplusplus.com/doc/tutorial/classes/ is the best c++ tutorial out there, and they also have a forum where you can post questions and they get answered quickly. I love that site, learned so much there!

Re: Confusion

Posted: Wed Jan 26, 2011 11:13 am
by GroundUpEngine
adikid89 wrote:Yes! http://www.cplusplus.com/doc/tutorial/classes/ is the best c++ tutorial out there, and they also have a forum where you can post questions and they get answered quickly. I love that site, learned so much there!
+1 :)

Re: Confusion

Posted: Wed Jan 26, 2011 6:03 pm
by THe Floating Brain
Originally I thought it was a constructor. What confused me was the white space between Dude and man (I do not usualy use constructors in that fashion) and you did not explain if cow earlobe etc. were instances of a class private members of that particular class or something else. Again I do understand C++ the way you wrote it was just a little confusing.

Re: Confusion

Posted: Thu Jan 27, 2011 12:32 am
by XianForce
THe Floating Brain wrote:Originally I thought it was a constructor. What confused me was the white space between Dude and man (I do not usualy use constructors in that fashion) and you did not explain if cow earlobe etc. were instances of a class private members of that particular class or something else. Again I do understand C++ the way you wrote it was just a little confusing.
That's how you'd normally statically allocate an object with a constructor having parameters... What I really don't understand, is why after countless people have told your to review some C++ topics, you refuse and go on to say you know C++, and we've shown time and time again, that you should review this stuff. Regardless of how well (you think) you know it, it's blatantly obvious (in my opinion), that you need to review some stuff.

You came here to ask a question, which implies that you are going to trust whatever input we give you... One of those pieces of input is that you should review general use of classes to better familiarize yourself with concepts.

But in the end, the choice is yours...

Re: Confusion

Posted: Thu Jan 27, 2011 8:59 pm
by THe Floating Brain
I understand were you are coming from. But I realy have a good grasp on C++ I understand it very well (I <3 C++ ). Somtimes I would even spend a month or two going over the same tutorial until I knew I got it right then practice then consult poeple I knew in real life and reapeat (when I was learning for the past 3 years). Also you have to understand I did just get out of the command promp/game maker 8 stage (which I stayed in for about 4 months) I am new to game dev (about 7 months in) and a fourm with programmers of this level. (Not saying all the programmers on antiRTFM's fourm are not exparanced.) I know I usialy sound like a idout and I kick myself everytime I do but I do have a better understanding then I let off.

Re: Confusion

Posted: Fri Jan 28, 2011 9:39 am
by Sam034
Stop trying to learn the basics with tutorials and online sources. Buy a book. Most books assume you don't know anything about the language and explain things in extra detail so you understand them. You have been practicing c++ for 3 years.... Have you ever thought that maybe online sources weren't the best place to start at?