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
Yusairi: site expert
http://www.codetoad.com









CodeToad Experts

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








Recent Forum Threads
• Re: Help Running VB script in Windows 2003
• ONUNLOAD
• Re: Insert Contents of .txt file into a .html page
• Re: Perl regular expression problem.
• Re: Problems in login using WWW::Mechanize
• searching for gd::graph guide
• Re: ARRAY OF HASHMAPS
• Adv. Regexp or Otherwise
• Adv. Regexp or Otherwise


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-2008