Results 1 to 3 of 3

Thread: Making an entire class private

  1. #1
    Join Date
    Apr 2009
    Posts
    47

    Making an entire class private

    hi,
    I am currently in the process of coding a function that uses a class.Let me explain in detail...
    Code:
      CalculateValue  int ();
    This function uses a class that I coded, therefore it instantiate class, method that are used etc.. But now I want my function "CalculateValue' can not be access by variable from outsite of class.

    Is this possible?

  2. #2
    Join Date
    May 2008
    Posts
    2,012

    Re: Making an entire class private

    Much better: if you implement your function in a cpp file and you can implements the class in that file (no header or anything else for this class :
    Code:
    private class 
      ( 
      public: 
    private int () 
      ( 
      Return 42; 
      ) 
      / / Etc ... 
      );
    Like that, your function can be accessible in this class only and it will not possible for anything else to have the class definition.
    This is called an implementation.

  3. #3
    Join Date
    May 2008
    Posts
    2,389

    Re: Making an entire class private

    1. -Create a new application in C++

    2. -Add the following code about
    your class:

    Code:
    class addressC {
           //
           private:
            //
            string abs;
            string SSS;
            string fff;
            //
           public:
            addressC( string absS, string  SSSS, string  fffS); // constructor
            ~addressC(); // destructor
            void PROCView();
          };
    3. -Then give the code for the procedures or functions used in that
    class.

Similar Threads

  1. Replies: 11
    Last Post: 22-03-2012, 10:58 PM
  2. Replies: 8
    Last Post: 08-10-2011, 11:06 PM
  3. Replies: 4
    Last Post: 08-08-2011, 09:31 AM
  4. Replies: 5
    Last Post: 16-03-2010, 04:51 AM
  5. Good news for CBSE CLASS X & CLASS IX - visit learnnext
    By surya_expert in forum Education Career and Job Discussions
    Replies: 0
    Last Post: 13-12-2008, 12:09 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,714,010,484.89224 seconds with 17 queries