Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Technical Support
 1533: operators and the using declaration

You must be registered to post a reply.
Click here to register.

Screensize:
UserName:
Password:
Format: BoldItalicizeUnderlineStrikethrough Align leftCenterAlign right Insert horizontal ruleUpload and insert imageInsert hyperlinkInsert email addressInsert codeInsert quoted textInsert listInsert Emoji
   
Message:

Forum code is on.
Html is off.

 
Check to subscribe to this topic.
   

T O P I C    R E V I E W
.oisyn Posted - Sep 19 2006 : 08:43:03 AM
struct A
{
	void foo();
	void operator[](int) const { }
};

struct B : public A
{
	using A::foo;
	using A::operator[]; // #1
};


The keyword 'operator' in #1 shows with a red underline for some reason. Using the using declaration with regular functions works fine.
3   L A T E S T    R E P L I E S    (Newest First)
feline Posted - Oct 02 2006 : 11:47:12 AM
*ah* I ended up with a different idea, based on an example in More Effective C++ by Meyers, where "using" makes a private function from the base class public in the derived class.

this also makes sense.
.oisyn Posted - Sep 26 2006 : 07:02:21 AM
For the record ;) :

Well in my example it is pointless of course, but it's used to unhide base members if you're implementing the same function with a different signature in a derived class.

struct Base
{
    void operator() (int);
};

struct Derived : public Base
{
    using Base::operator();         // #1
    void operator() (const char *); // #2
};

void foo()
{
    Derived d;
    d(123);  // isn't possible without #1 as #2 hides all base members with the same name.
}
feline Posted - Sep 23 2006 : 5:08:16 PM
confirmed.

case=2674

i had to go and look that one up to work out what you were doing

© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000