473,399 Members | 3,603 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

Weird protected access problem.

Hi, folks,
My g++ is of version 3.4.2, here is the code snippet:

#include <iostream>

using namespace std;

class Base {
protected:
Base() {
cout << "This is B\n";
}
};

template<typename T>
class Derived: public Base {
public:
Derived(){}
Derived(const Base& b): Base(b) {}

Derived<TD() {
Base b;
return Derived<T>(b);
}
};

int main() {
Derived<intobj;

obj.D();

return 1;
}

When I tried to build this program, an error arraised:

test.cpp:7: error: `Base::Base()' is protected
test.cpp:18: error: within this context

Any informative tips will be appreciated, thank you.

Best regards.

Aug 24 '07 #1
0 897

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Todd A. Anderson | last post by:
Hi...any help would be appreciated. Kind of a weird scenario but I have foo's that point to bars and whenever anybody tries to use a foo as a pointer I want it typed as a baz * and likewise if...
3
by: Wayne Dyer | last post by:
I can duplicate this, so I know it's not something I'm imagining and wonder if anyone else has seen it. Take a page, put a drop down control on it, hook up the onChange event handler to go get...
0
by: dhnriverside | last post by:
Hi peeps OK, I'm getting a weird error trying to select a DDL item based on what's stored in the database. I have 4 DDLs on my aspx page... <asp:dropdownlist id="ddlStartTimeHour"...
0
by: I am Sam | last post by:
Ok whats wrong with my toolbar? When I debug I don't get an error message and the databinding is working correctly but the toolbar itself and the <iewc:ToolbarDropDownlist /> control isn't showing...
11
by: Kevin Prichard | last post by:
Hi all, I've recently been following the object-oriented techiques discussed here and have been testing them for use in a web application. There is problem that I'd like to discuss with you...
7
by: atomik.fungus | last post by:
Hi, im having problems compiling some code, and i dont understand why. I've made a Matrix class for any kind of data and now im implementing an inherited class with all the mathematical stuff...
1
by: Mark Denardo | last post by:
I recently upgraded to VS2005 and converted some projects from 1.1 to 2.0 and am seeing two weird behaviors I can't seem to resolve, and am wondering if they are bugs or something I'm forgetting to...
3
by: =?Utf-8?B?dmluY2VudHc1Ng==?= | last post by:
I have an ASP.NET 2.0 application. It is pretty basic. What it does is shows a gridview of data from a stored procedure. The user can also select a date filter. The problem is that sometimes an...
4
by: Lucas Kanebley Tavares | last post by:
Hey all, I'm working on a project with a layout similar to this: class A { protected: A *next; int i; public: void m(A *a);
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.