Noob programer

Discussion in 'Mac Programming' started by DanB91, Jul 2, 2007.

  1. DanB91 macrumors 6502

    Jun 12, 2007
    I am a very new programmer (age 15 :)) and i just started watching tutorials on C++. I can write a VERY simple program (simple calculator, but its ALOT of code) but there are a few concepts im trying to grasp but i just cant such as: pointers and classes. Can someone please clarify these 2 points for me?

    Thanx soo much

    I really want to become a programmer b/c i am sick of people not porting (or correctly porting) a program thats windows based for mac. I want to really aid in that situation.
  2. SC68Cal macrumors 68000

    Feb 23, 2006
    About classes:

    As you're reading through that, click on the links. The link about "software crisis" is important to understand why classes and OO programming exists.

    Don't worry about porting windows software to OS X right now. Work on building a strong foundation, learn about the history of programming. The "whys" are as important as the "hows"

    Any questions, feel free to contact me
  3. MongoTheGeek macrumors 68040


    Sep 13, 2003
    Its not so much where you are as when you are.
    Classes are a type. To use a concrete example, dog is a class. Your dog spot is an object. It is a physical thing. You dog belongs to the class dog. Dog implements certain methods that are particular to dogs such as piddle on the floor and bark. The dog class is a subclass of mammal. So it is a specialized mammal that knows how to bark and piddle on the floor, but it also implements all of the methods of mammal such as shed hair.

    A pointer is what it sounds like. Instead of being an object or a string or a number its just a pointer to where the number string or object is. Now there are a couple of reasons for it. The first is it saves time and memory because if you want to pass a large object around you don't have to give everyone their own copy. You can just tell them where yours is. The second reason is it allows them to work on and modify your copy.

    In C++ and object oriented programming it helps in obfuscation. You know that you are getting a pointer to an object of some class(or any of its subclasses) It doesn't matter to you what it is, what matters is that it has certain methods.
  4. DanB91 thread starter macrumors 6502

    Jun 12, 2007
    thanx ill just watch the tutorial another time and see if i can understand when to use pointers. sometimes they just whip out those asterisks for some reason, and either dont explain it, or explain it in a bad way.

    classes is a video ill have to watch 1000 times, ik it takes patience but thanx for the help!

    actually can anyone explain the point of private in a class? it just seems harder to get to and thats it

  5. SC68Cal macrumors 68000

    Feb 23, 2006
    The point of private variables is that you know that you'll never need them outside of that class, and that you really don't want outside influences playing with those variables.
  6. DanB91 thread starter macrumors 6502

    Jun 12, 2007
    thanx every one for their help. i really hope i can do C++ :) its so goddamn hard

Share This Page