codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  protected access/inheritance  craigb at 21:50 on Thursday, August 18, 2005
 

I have a question about access control in C++:

// base.h

class base
{
protected:
virtual int f() { return -1; }
};

--------------------------------------------------------------------

// derived.h

class derived : public base
{
private:
base* b;
protected:
virtual int f() {
b = new base();
return b->f();
}
};


--------------------------------------------------------------------

This doesn't compile. Why not? How can I call b's version of f()?

Thanks!

  Re: protected access/inheritance  Yusairi at 04:18 on Friday, August 26, 2005
 

A member (either data member or member function) declared in a protected section of a class can only be accessed by member functions and friends of that class, and by member functions and friends of derived classes








CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums








Recent Forum Threads
• Global.Mapper.v15.2.3.b060614
• Geometric_Glovius_Pro_v3.6.1
• VERO.SurfCAM.v2014
• Schlumberger.Petrel.V2013.2
• Petrel.V2013.2
• Altair.HyperWorks.v12
• VoluMill.v6.1
• VoluMill.NEXION.6
• VERO.SurfCAM.v2014


Recent Articles
ASP GetTempName
Decode and Encode UTF-8
ASP GetFile
ASP FolderExists
ASP FileExists
ASP OpenTextFile
ASP FilesystemObject
ASP CreateFolder
ASP CreateTextFile
Javascript Get Selected Text


© Copyright codetoad.com 2001-2014