473,473 Members | 2,031 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Nested classes and templates

Hello,

Code below.

I've run into the following problem. I want to pass DCManagedTexture*
as a template parameter into the DCDefaultResourceManager template. The
DCManagedTexture class is nested inside the DCTextureManager class. The
compiler (msvc 7.1)complains that it doesn't know anything about
DCTextureManager::DCManagedTexture* which is probably right. So I tried
to forward reference it (before the class declaration) with sth like:

class DCTextureManager;
class DCTextureManager::DCManagedTexture;

This does not work either. How can I pass the inner nested class as a
template parameter into the template parameter of the base class of the
enclosing class . Is this possible at all?
My alternative solution is to move the nested class outside of the
enclosing class, make it's contructors protected and declare it as a
friend in DCTextureManager to get the encapsulation I want. Does this
sound good or is there a better way?

Thanks for your answer!

-Matthias
Code:

class DCTextureManager : public
DCDefaultResourceManager<DCTextureManager::DCManag edTexture*>
{
public:
class DCManagedTexture : public DCResource, public DCMaterial
{}
};

Jul 23 '05 #1
1 2029
ni*********@web.de wrote:
Code below.

I've run into the following problem. I want to pass DCManagedTexture*
as a template parameter into the DCDefaultResourceManager template. The
DCManagedTexture class is nested inside the DCTextureManager class. The
compiler (msvc 7.1)complains that it doesn't know anything about
DCTextureManager::DCManagedTexture* which is probably right. So I tried
to forward reference it (before the class declaration) with sth like:

class DCTextureManager;
class DCTextureManager::DCManagedTexture;

This does not work either. How can I pass the inner nested class as a
template parameter into the template parameter of the base class of the
enclosing class . Is this possible at all?
Nope.
My alternative solution is to move the nested class outside of the
enclosing class, make it's contructors protected and declare it as a
friend in DCTextureManager to get the encapsulation I want. Does this
sound good or is there a better way?
Yep.
[...]

Jul 23 '05 #2

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

Similar topics

1
by: Alexander Stippler | last post by:
Hi what's wrong about the following code? It does not compile. template <typename T> class A { public: class B; };
11
by: cyberdave | last post by:
Someone please help me! I have a template class like this: -------------------------------------------------- template<typename T> class List { public:
6
by: B0nj | last post by:
I've got a class in which I want to implement a property that operates like an indexer, for the various colors associated with the class. For instance, I want to be able to do 'set' operations...
8
by: Robert W. | last post by:
I've almost completed building a Model-View-Controller but have run into a snag. When an event is fired on a form control I want to automatically updated the "connnected" property in the Model. ...
2
by: Bob Day | last post by:
Using VS2003, VB.NET, MSDE... I am looking at a demo program that, to my surprise, has nested classes, such as the example below. I guess it surprised me becuase you cannot have nested subs,...
4
by: Schüle Daniel | last post by:
Hello all, my question is basically wheather it's possible to have nested templates .. I mean the following if there are one templ. class and one global templ. function is it possible to...
2
by: miked | last post by:
I am architecting in a read only class for use in mapping data to a business object. The object makes strong use of nested classes and their ability to access protected fields. The downside is...
2
by: pagekb | last post by:
Hello, I'm having some difficulty compiling template classes as containers for other template objects. Specifically, I have a hierarchy of template classes that contain each other. Template...
9
by: stephen.diverdi | last post by:
Can anyone lend a hand on getting this particular template specialization working? I've been trying to compile with g++ 4.1 and VS 2005. ...
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
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
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,...
1
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...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.