Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6558467
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T13:12:13+00:00 2026-05-25T13:12:13+00:00

I am using code::blocks, with, I believe gcc. Given the example code (this is

  • 0

I am using code::blocks, with, I believe gcc. Given the example code (this is pseudo code and may not replicate the problem):

//Assume this is in a separate header file to B
class TestA
{
    protected:
        int A;

    public:
        void Function1(){A = 0;}
};

class TestB : public TestA
{
    public:
        void CallFunction(){ A = 10; Function1();}//
};

I would get similar compile errors, like:
Error: ‘A’ not declared in this scope.
Error: Function1() not declared in this scope.

I was under the impression that all base variables and functions were inherited to the subclass. Given the base class has a lot of functions and variables, I don’t want to use the ‘using’ keyword as I’d have to declare it for every function and variable (to my knowledge).

Is there any way to make it so TestB explicitly or actually includes the stuff it’s inheriting?

Relevant snippets below

Okay. It’s not possible to include example code as it’s in project, but I will quote the key snippets:

C:\Users\user\Desktop\Projects\RND2\TemplateListAdv.h|30|error: 'Size' was not declared in this scope|

The line this is on is:

if(!Array.SetToSize(Size))

The class it’s in is:

template<typename TemplateItem>
class TemplateListAdv : public TemplateList<TemplateItem>

And the incriminating line from TemplateList is:

SIZE_TYPE Size; //SIZE_TYPE is unsigned long.
//SIZE_TYPE is available in all files as unsigned long.

Files go:
TemplateList.h->TemplateBasics.h->TemplateListAdv.h

No missing files from what I can see.

I will tack in, the ‘using’ keyword resolves it individually, but this has been bugging me as I thought inheritance was automatic.

Compiler data as requested:

“Release 10.05 rev 6283 (2010-05-27 09:09:13) gcc 4.4.1 Windows/unicode – 32 bit”

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T13:12:13+00:00Added an answer on May 25, 2026 at 1:12 pm

    The problem that you’re having about accessing base class stuff in a class template, is a FAQ item.

    Rather then quoting the whole FAQ item here, I just link to it: that’s your answer.

    The code that you presented to illustrate the problem was unrelated, sorry. It is always a good idea to give an actual example rather than an example of what one thinks might be the problem.

    Cheers & hth.,

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using code blocks or Dispose method hasn't used in this MSDN example about dialog
NOTE: I do believe that this is not an openCV related problem but since
Given this code: using (var conn = new SqlConnection(...)) { conn.Open(); using (var cmd
I'm using Code::Blocks to compile a shared library on Ubuntu. When I make a
We're developing a Qt project using the Code::Blocks IDE with the QtWorkbench plugin. We'd
Out of habit I've been using try/catch blocks in my application code for all
I seem to be using this block of code alot in Python. if Y
I'm using Code::Blocks to build my project, which contains three files: main.cpp , TimeSeries.cpp
I've been using Code::Blocks with MinGW on a WinXP box for a while now.
Hello I'm trying to write some tool using code::blocks, wxWidgets and libxml2 on Windows

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.