By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,853 Members | 2,144 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,853 IT Pros & Developers. It's quick & easy.

About finding name in dependent base classes

P: 30
Hi every body,
It said that standard C++ says nondependent names are not looked up in dependent base classes,in c++ template 9.4.2..
Expand|Select|Wrap|Line Numbers
  1. template<typename X>
  2.  
  3.   class Base{
  4.  
  5.   public:
  6.  
  7.   int basefield;
  8.  
  9.   typedef int T;
  10.  
  11.   };
  12.  
  13.   template <typename T>
  14.  
  15.   class DD:Base<T>{
  16.  
  17.   public:
  18.  
  19.   void f(){
  20.  
  21.    basefield = 0;//problem??
  22.    this->basefield = 0;//ok
  23.    cout<<basefield<<endl;
  24.   }
  25.  
  26.   };
  27.  
But there is no diffrence between 'this->basefield' and ‘basefield without this’,in MS vs 2008.They both can find the name of basefield in dependent base classe--Base ,Why?
Oct 20 '10 #1
Share this Question
Share on Google+
1 Reply


P: 30
Anybody know?
Nov 18 '10 #2

Post your reply

Sign in to post your reply or Sign up for a free account.