Results 1 to 4 of 4

Thread: Methods not accessible by other classes

  1. #1
    Join Date
    Apr 2009
    Posts
    87

    Methods not accessible by other classes

    I have created a class "map" that can load a file from a special format but which can save data in a file format. There is also a class "Game" and a class "Publisher". Is it possible to ensure that the class never use the recording method and inverse method for the Publisher? Thank you for your answers.

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

    Re: Methods not accessible by other classes

    Normally when you want to call method of any other class we need to create its object then we can access its methods. Namespaces allow to group entities like classes, objects and functions under a name. This way the global scope can be divided in "sub-scopes", each one with its own name.

  3. #3
    Join Date
    Jan 2009
    Posts
    199

    Re: Methods not accessible by other classes

    Check this Example :
    Code:
    namespace Box1{
      int boxSide = 4;
    
    
    }
    
    namespace Box2{
      int boxHeight = 12; 
    
    
    }
    
    int main () {
     cout << Box1::boxSide << endl;    //output 4
     cout << Box2::boxHeight << endl;  //output 12
     return 0;
    
    
    }

  4. #4
    Join Date
    Dec 2008
    Posts
    177

    Re: Methods not accessible by other classes

    You can only assure that nobody will use these methods to the class one and another class putting them in private, but if you give them access to a method, you necessarily give them access to those same accessibility (public, private or protected).

Similar Threads

  1. WebUI only Accessible via LAN
    By Illinois in forum Windows Software
    Replies: 6
    Last Post: 29-06-2010, 09:17 AM
  2. C # using classes in C + +
    By klite in forum Software Development
    Replies: 3
    Last Post: 01-10-2009, 10:15 AM
  3. Classes in VB.NET
    By Samir_1 in forum Software Development
    Replies: 2
    Last Post: 10-04-2009, 12:07 AM
  4. My session not accessible
    By blindsleeper in forum Operating Systems
    Replies: 5
    Last Post: 04-10-2008, 03:26 PM
  5. Desktop not accessible
    By samit in forum Windows XP Support
    Replies: 2
    Last Post: 17-10-2006, 03:06 AM

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,713,878,293.00233 seconds with 17 queries