[Webinar] Streamline your web hosting managementRegister Today

x
?
Solved

VC 6.0 Error

Posted on 2003-03-28
2
Medium Priority
?
251 Views
Last Modified: 2010-04-01
Hello experts,

I was wondering what syntax is used for this overloading function:
//.h
namespace T {
   class S {
      public:
         //...
         friend S operator * (const S&, const S&);
         //...
   };
}

I tried
//.cpp
S T::operator * (const S& Ia, const S& Ib) {}

but instead got an error "missing ; before tag::id." I'm pretty sure all my ';'s are accounted for. Thanks, =)
0
Comment
Question by:n_fortynine
2 Comments
 
LVL 15

Accepted Solution

by:
efn earned 200 total points
ID: 8229837
Hi n_fortynine,

You need to get all the Ses qualified as well as the operator keyword.  There are multiple ways to do it.

Inside the namespace T block, you could have:

S operator * (const S& Ia, const S& Ib) {}

Outside the namespace T block, you could have:

T::S T::operator * (const T::S& Ia, const T::S& Ib) {}

Or you could tell the compiler to look for S in namespace T like this:

using T::S;

S T::operator * (const S& Ia, const S& Ib) {}

--efn
0
 
LVL 4

Author Comment

by:n_fortynine
ID: 8229877
Thanks efn. Man, it's embarassingly obvious... =) Why didn't I see that
0

Featured Post

[Webinar] Kill tickets & tabs using PowerShell

Are you tired of cycling through the same browser tabs everyday to close the same repetitive tickets? In this webinar JumpCloud will show how you can leverage RESTful APIs to build your own PowerShell modules to kill tickets & tabs using the PowerShell command Invoke-RestMethod.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
Suggested Courses

607 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question