View Single Post
  #12   Spotlight this post!  
Unread 29-01-2009, 18:14
Dave Scheck's Avatar
Dave Scheck Dave Scheck is offline
Registered User
FRC #0111 (WildStang)
Team Role: Engineer
 
Join Date: Feb 2003
Rookie Year: 2002
Location: Arlington Heights, IL
Posts: 574
Dave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond repute
Re: define a new class(C++)

Quote:
Originally Posted by nadavsen2 View Post
i didnt put those lines

#ifndef CAMERA_H
#define CAMERA_H

and the #endif..

what is this macro? or its not macro?
It's called a header guard. You can read about it here or here

Quote:
why in the OperatorControl you access you class by typing
Camera c();

and not
Camera *c;
c = new Camera();
In the end both of those do the same thing, instantiate a Camera called c. Which one you use depends on how you plan to use it. If you're only using it in that location and you don't need to pass it around, you can use the non-pointer version. If you plan to be passing the object around, or it is an attribute of a class you'll want to use the pointer approach.

Last edited by Dave Scheck : 29-01-2009 at 18:16.
Reply With Quote