Confusion

Whether you're a newbie or an experienced programmer, any questions, help, or just talk of any language will be welcomed here.

Moderator: Coders of Rage

User avatar
Ginto8
ES Beta Backer
ES Beta Backer
Posts: 1064
Joined: Tue Jan 06, 2009 4:12 pm
Programming Language of Choice: C/C++, Java

Re: Confusion

Post 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.
Quit procrastinating and make something awesome.
Ducky wrote:Give a man some wood, he'll be warm for the night. Put him on fire and he'll be warm for the rest of his life.
User avatar
THe Floating Brain
Chaos Rift Junior
Chaos Rift Junior
Posts: 284
Joined: Tue Dec 28, 2010 7:22 pm
Current Project: RTS possible Third Person shooter engine.
Favorite Gaming Platforms: PC, Wii, Xbox 360, GAME CUBE!!!!!!!!!!!!!!!!!!!!!!
Programming Language of Choice: C/C++, Python 3, C#
Location: U.S

Re: Confusion

Post 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!!!
"Why did we say we were going to say we were going to change the world tomorrow yesterday? Maybe you can." - Myself

ImageImage
User avatar
Ginto8
ES Beta Backer
ES Beta Backer
Posts: 1064
Joined: Tue Jan 06, 2009 4:12 pm
Programming Language of Choice: C/C++, Java

Re: Confusion

Post 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.
Quit procrastinating and make something awesome.
Ducky wrote:Give a man some wood, he'll be warm for the night. Put him on fire and he'll be warm for the rest of his life.
N64vSNES
Chaos Rift Devotee
Chaos Rift Devotee
Posts: 632
Joined: Thu Aug 12, 2010 11:25 am

Re: Confusion

Post by N64vSNES »

Ginto8 wrote:However, a better idea is just to use a constructor.
This^ ;)
User avatar
THe Floating Brain
Chaos Rift Junior
Chaos Rift Junior
Posts: 284
Joined: Tue Dec 28, 2010 7:22 pm
Current Project: RTS possible Third Person shooter engine.
Favorite Gaming Platforms: PC, Wii, Xbox 360, GAME CUBE!!!!!!!!!!!!!!!!!!!!!!
Programming Language of Choice: C/C++, Python 3, C#
Location: U.S

Re: Confusion

Post 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?
"Why did we say we were going to say we were going to change the world tomorrow yesterday? Maybe you can." - Myself

ImageImage
User avatar
Ginto8
ES Beta Backer
ES Beta Backer
Posts: 1064
Joined: Tue Jan 06, 2009 4:12 pm
Programming Language of Choice: C/C++, Java

Re: Confusion

Post 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.
Quit procrastinating and make something awesome.
Ducky wrote:Give a man some wood, he'll be warm for the night. Put him on fire and he'll be warm for the rest of his life.
User avatar
THe Floating Brain
Chaos Rift Junior
Chaos Rift Junior
Posts: 284
Joined: Tue Dec 28, 2010 7:22 pm
Current Project: RTS possible Third Person shooter engine.
Favorite Gaming Platforms: PC, Wii, Xbox 360, GAME CUBE!!!!!!!!!!!!!!!!!!!!!!
Programming Language of Choice: C/C++, Python 3, C#
Location: U.S

Re: Confusion

Post 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. :-)
"Why did we say we were going to say we were going to change the world tomorrow yesterday? Maybe you can." - Myself

ImageImage
XianForce
Chaos Rift Devotee
Chaos Rift Devotee
Posts: 767
Joined: Wed Oct 29, 2008 8:36 pm

Re: Confusion

Post 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...
User avatar
Ginto8
ES Beta Backer
ES Beta Backer
Posts: 1064
Joined: Tue Jan 06, 2009 4:12 pm
Programming Language of Choice: C/C++, Java

Re: Confusion

Post 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.
Quit procrastinating and make something awesome.
Ducky wrote:Give a man some wood, he'll be warm for the night. Put him on fire and he'll be warm for the rest of his life.
User avatar
adikid89
Chaos Rift Cool Newbie
Chaos Rift Cool Newbie
Posts: 94
Joined: Tue Apr 27, 2010 6:59 am
Current Project: small tiny-mini projects
Favorite Gaming Platforms: PC I guess...
Programming Language of Choice: c++

Re: Confusion

Post 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!
My first game C++/SDL Yoshi Combat! = http://www.youtube.com/watch?v=HQ9mMBEWSZg
==============================================================
Image
User avatar
GroundUpEngine
Chaos Rift Devotee
Chaos Rift Devotee
Posts: 835
Joined: Sun Nov 08, 2009 2:01 pm
Current Project: mixture
Favorite Gaming Platforms: PC
Programming Language of Choice: C++
Location: UK

Re: Confusion

Post 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 :)
User avatar
THe Floating Brain
Chaos Rift Junior
Chaos Rift Junior
Posts: 284
Joined: Tue Dec 28, 2010 7:22 pm
Current Project: RTS possible Third Person shooter engine.
Favorite Gaming Platforms: PC, Wii, Xbox 360, GAME CUBE!!!!!!!!!!!!!!!!!!!!!!
Programming Language of Choice: C/C++, Python 3, C#
Location: U.S

Re: Confusion

Post 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.
"Why did we say we were going to say we were going to change the world tomorrow yesterday? Maybe you can." - Myself

ImageImage
XianForce
Chaos Rift Devotee
Chaos Rift Devotee
Posts: 767
Joined: Wed Oct 29, 2008 8:36 pm

Re: Confusion

Post 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...
User avatar
THe Floating Brain
Chaos Rift Junior
Chaos Rift Junior
Posts: 284
Joined: Tue Dec 28, 2010 7:22 pm
Current Project: RTS possible Third Person shooter engine.
Favorite Gaming Platforms: PC, Wii, Xbox 360, GAME CUBE!!!!!!!!!!!!!!!!!!!!!!
Programming Language of Choice: C/C++, Python 3, C#
Location: U.S

Re: Confusion

Post 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.
"Why did we say we were going to say we were going to change the world tomorrow yesterday? Maybe you can." - Myself

ImageImage
Sam034
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 6
Joined: Sat Jan 22, 2011 2:35 pm

Re: Confusion

Post 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?
Post Reply