Thread: Class Scope

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Nov 2006
    Posts
    224

    Lightbulb Class Scope

    Hi,

    Can an instantiation of a sub-class call a function member of the class from which it is derived? (that sounds weird)

    Basically...
    eg)
    Code:
    class example { // Abstract Class
    
    	protected:
    		int x;
    		
    	public:
    		void setX (int in_x) {x = in_x;}
    		class chair {
    			protected:
    				float y;
    				
    			public:
    				void setY (float in_y) {y = in_y;}
                                                    };
    };
    If I have an object:
    example::chair abc;

    Can I access setX with abc? Perhaps not with this code example but how could this be achieved?

    Thanks
    Last edited by strokebow; 12-17-2008 at 04:44 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Inherite nonvirtual class functionality
    By DrSnuggles in forum C++ Programming
    Replies: 2
    Last Post: 04-30-2009, 01:52 PM
  2. Help with FIFO QUEUE
    By jackfraust in forum C++ Programming
    Replies: 23
    Last Post: 04-03-2009, 08:17 AM
  3. class composition constructor question...
    By andrea72 in forum C++ Programming
    Replies: 3
    Last Post: 04-03-2008, 05:11 PM
  4. Class scope variables
    By filler_bunny in forum C++ Programming
    Replies: 2
    Last Post: 08-23-2003, 02:14 AM