473,394 Members | 1,829 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,394 software developers and data experts.

Re: friend declared function call

>The following alternatives DON'T work:
>>
wurst::foobla(foo,2)

This is OK.
No, it isn't. (At least, if it isn't a gcc bug)

gcc says something like "no member foobla in wurst".
Jun 27 '08 #1
1 1917
>>The following alternatives DON'T work:
>>>
wurst::foobla(foo,2)

This is OK.

No, it isn't. (At least, if it isn't a gcc bug)

gcc says something like "no member foobla in wurst".
OK, minimal non-compiling example:

namespace wurst {
class bla {
friend bool foobla(const bla& v, int x) {
return true;
}
};
}

int main()
{
wurst::bla foo;
wurst::foobla(foo, 2);
return 0;
}
LANG=C g++ test.cpp gives:
test.cpp: In function 'int main()':
test.cpp:12: error: 'foobla' is not a member of 'wurst'
Jun 27 '08 #2

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

Similar topics

8
by: Nitin Bhardwaj | last post by:
Thanx in advance for the response... I wanna enquire ( as it is asked many a times in Interviews that i face as an Engg PostGraduate ) about the overloading capability of the C++ Language. ...
1
by: Mike - EMAIL IGNORED | last post by:
Are static friend functions allowed? I tried this today with gcc-3.2 without success. The function was not a class member. The friend statement was interpreted as meaning "extern", and this was...
5
by: Trevor Lango | last post by:
What is the appropriate syntax for placing a friend function that includes as one of it's parameters a pointer to the class object itself within the template class? I have the following: ...
10
by: Piotr Wyderski | last post by:
Hello, is it possible to reuse a friend operator which is defined inside a class? I'd like to obtain the following behaviour: class integer { integer operator +(signed long int v) const...
2
by: Gergely Korodi | last post by:
Hello, I have two classes, say A and B, defined in header files "A.hh" and "B.hh," respectively. The definition of class B looks like #ifndef _B_HH_ #define _B_HH_ #include "A.hh" //...
2
by: wongjoekmeu | last post by:
Hello all, I have the following problem, maybe someone can help me out. I have a template class A which has a protected member Aint. Now I have template class B which has as private member an...
15
by: Samee Zahur | last post by:
Question: How do friend functions and static member functions differ in terms of functionality? I mean, neither necessarily needs an object of the class to be created before they are called and...
4
by: fdmfdmfdm | last post by:
I have the following code: #include <iostream> #include <cstdlib> #include <cassert> using namespace std; template <class T> class Stack{ public: enum{DefaultStack = 10, EmptyStack = -1};
0
by: Christopher | last post by:
On Apr 11, 12:07 am, Ian Collins <ian-n...@hotmail.comwrote: I've never seen those implemented _inside_ the class, but defined and implemented outside the class and then made a friend of the...
21
by: H9XLrv5oXVNvHiUI | last post by:
Hi, I have a question about injecting friend functions within template classes. My question is specific to gcc (version 3.4.5) used in combination with mingw because this code (or at least code...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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...

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.