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

Tags: , , ,

Sponsored Links


Accessing Objects Outside Of Class

Software Development


Reply
 
Thread Tools Search this Thread
  #1  
Old 22-02-2010
Level8's Avatar
Member
 
Join Date: Nov 2009
Posts: 871
Accessing Objects Outside Of Class

Sponsored Links
Hello, I am learning C++ programming language and while working on it, I am searching for the program or help which will solve the problem of Accessing Objects Outside Of Class. I have tried to use it, but it returned with an error. So, if you are having any solution for achieving it, then please help me to get the solution for it.

Reply With Quote
  #2  
Old 22-02-2010
Member
 
Join Date: May 2008
Posts: 2,000
Re: Accessing Objects Outside Of Class

Hello, Same problem here also. I have a game play has done in C + + and for now I have a little trouble. I have classes with a class team, teammate and all. In the class 'team' I declare an object tray and PL class teammate I want to access object attributes PL I said in class team so I made a PL.getValeur (getValeur is a method of Class shelf) but it is not working it says 'error C2065:' PL ': undeclared identifier'. Can anyone help me?
Reply With Quote
  #3  
Old 22-02-2010
Zecho's Avatar
Member
 
Join Date: May 2008
Posts: 2,278
Re: Accessing Objects Outside Of Class

if you want to access a class member in c++ then you must need to make use of the code below:
Code:
    Object_name.Functionname (arguments);
And your class and object definition is performed as below:
Code:
    class Test
    {
       int num1, num2;
       public:
       void sum(int,int);
    } emp;
Reply With Quote
  #4  
Old 22-02-2010
kelfro's Avatar
Member
 
Join Date: Apr 2008
Posts: 1,990
Re: Accessing Objects Outside Of Class

Following are the tips for choosing an Access Level: If other programmers use your class, you want to ensure that errors from misuse cannot happen. Access levels can help you do this.
  • Use the most restrictive access level that makes sense for a particular member. Use private unless you have a good reason not to.
  • Avoid public fields except for constants. Public fields tend to link you to a particular implementation and limit your flexibility in changing your code.
Reply With Quote
  #5  
Old 22-02-2010
opaper's Avatar
Member
 
Join Date: May 2008
Posts: 2,371
Re: Accessing Objects Outside Of Class

Hello, I think you must need to use the books on C++ as below:
  • C++ GUI Programming with Qt 3
  • C++ Reference Guide
  • The ZooLib Cookbook
  • C++ in action
  • Optimizing C++
Reply With Quote
Reply

  TechArena Community > Software > Software Development


Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Accessing Objects Outside Of Class"
Thread Thread Starter Forum Replies Last Post
Upgrade Sony Ericsson Xperia Play Micro SD card from class 2 8GB to class 4 32GB Aaryan2011 Portable Devices 8 08-10-2011 11:06 PM
How Objects of class are created in C++? Alibamu Software Development 4 29-12-2010 05:24 AM
Instantiate different objects of same class ISAIAH Software Development 5 09-03-2010 09:05 AM
How to sort vector objects by class member variables in c++? Linoo Software Development 4 29-01-2010 06:15 PM
Good news for CBSE CLASS X & CLASS IX - visit learnnext surya_expert Education Career and Job Discussions 0 13-12-2008 11:09 AM


All times are GMT +5.5. The time now is 12:16 PM.