Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 23-10-2009
Member
 
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.
Reply With Quote
  #2  
Old 23-10-2009
Member
 
Join Date: May 2008
Posts: 2,293
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.
Reply With Quote
  #3  
Old 23-10-2009
Member
 
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;


}
Reply With Quote
  #4  
Old 23-10-2009
Member
 
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).
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Methods not accessible by other classes"
Thread Thread Starter Forum Replies Last Post
WebUI only Accessible via LAN Illinois Windows Software 6 29-06-2010 09:17 AM
C # using classes in C + + klite Software Development 3 01-10-2009 10:15 AM
Classes in VB.NET Samir_1 Software Development 2 10-04-2009 12:07 AM
My session not accessible blindsleeper Operating Systems 5 04-10-2008 03:26 PM
Desktop not accessible samit Windows XP Support 2 17-10-2006 03:06 AM


All times are GMT +5.5. The time now is 02:28 PM.