Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Can element types be the base class?

Reply
Thread Tools

Can element types be the base class?

 
 
PengYu.UT@gmail.com
Guest
Posts: n/a
 
      11-17-2007
Hi,

I'm wondering if there is any way to use element types as base
classes. Or it is not possible at all?

struct A : public int {
};

Thanks,
Peng
 
Reply With Quote
 
 
 
 
Kai-Uwe Bux
Guest
Posts: n/a
 
      11-17-2007
http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:

> Hi,
>
> I'm wondering if there is any way to use element types as base
> classes. Or it is not possible at all?
>
> struct A : public int {
> };


It's not possible.

You could provide a wrapper template

template < typename T >
class make_base {
...
};

and then do:

struct A : public make_base<int> {
};

But whatever you are trying to accomplish, this probably won't help.


On a related note: what are you trying to accomplish, anyway?


Best

Kai-Uwe Bux
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to Update/insert an xml element's text----> (<element>text</element>) HANM XML 2 01-29-2008 03:31 PM
Containg Types Or Base Types rn5a@rediffmail.com ASP .Net 0 11-22-2006 10:18 PM
Can XSD simple types be derived from complex types? Soren Kuula XML 2 12-01-2005 07:51 PM
Object creation - Do we really need to create a parent for a derieved object - can't the base object just point to an already created base object jon wayne C++ 9 09-22-2005 02:06 AM
Can TR element be direct child node of TABLE element? Patient Guy HTML 8 02-13-2005 03:25 PM



Advertisments