Thread: declaration two class problem

  1. #1
    Registered User
    Join Date
    Apr 2012

    declaration two class problem

    (I'm new to object oriented programming)
    I have a class a where I declare a variable

    class A { private: int x; }

    I have declared another class B in the project but in a different file

    when I use x it tells me that it isn't declared.

    How can I declare x so that it is visible to B?

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Problem with friend class declaration in a namespace
    By Angus in forum C++ Programming
    Replies: 2
    Last Post: 12-09-2008, 01:29 PM
  2. Class Declaration
    By enjoy in forum C++ Programming
    Replies: 4
    Last Post: 03-10-2006, 10:59 AM
  3. Replies: 7
    Last Post: 05-26-2005, 10:48 AM
  4. Replies: 2
    Last Post: 04-06-2005, 07:25 AM
  5. Class Declaration?
    By Unregistered in forum C++ Programming
    Replies: 1
    Last Post: 07-27-2002, 09:09 PM