473,399 Members | 4,254 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,399 software developers and data experts.

Some guidance

Hello,

I've a background in Java programming but I've just started to code a
bit in C++. I've come across some things in other developers code which
have confused me a bit. I'm hoping somebody here can clarify the
following code for me.

Snippet 1:
class Foo : public Bar {
...
Foo::Somefunction()
...
if (bytesread <= 0) {
// Close the connection
::close(fd);
i = clients.erase(i);
continue;
}
...
}
...
}

I thought that the ::close(fd) function called another function defined
in Foo, but there's no function with that name defined, then I thought
it must be in Bar, but still no sign. What does the :: point to?

Sometimes I see functions written as followed:

SomeObject::SomeFunction() {
....
}

and then some written like this:

OtherObject::OtherFunction() {
....
};

What does the ; at the end mean?

Thanks,

Sidaf

Jun 22 '06 #1
3 1065
sidaf wrote:
I've a background in Java programming but I've just started to code a
bit in C++. I've come across some things in other developers code
which have confused me a bit. I'm hoping somebody here can clarify the
following code for me.

Snippet 1:
class Foo : public Bar {
...
Foo::Somefunction()
...
if (bytesread <= 0) {
// Close the connection
::close(fd);
i = clients.erase(i);
continue;
}
...
}
...
}

I thought that the ::close(fd) function called another function
defined in Foo, but there's no function with that name defined, then
I thought it must be in Bar, but still no sign. What does the ::
point to?
Global namespace. 'close' is looked up in the global namespace. And
if there _is_ 'close' member in 'Foo' or 'Bar', it would be *ignored*.
Sometimes I see functions written as followed:

SomeObject::SomeFunction() {
...
}

and then some written like this:

OtherObject::OtherFunction() {
...
};

What does the ; at the end mean?


Usually means the programmer is sloppy.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Jun 22 '06 #2

Victor Bazarov wrote:
Global namespace. 'close' is looked up in the global namespace. And
if there _is_ 'close' member in 'Foo' or 'Bar', it would be *ignored*.
Sometimes I see functions written as followed:

SomeObject::SomeFunction() {
...
}

and then some written like this:

OtherObject::OtherFunction() {
...
};

What does the ; at the end mean?


Usually means the programmer is sloppy.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask


Ahh ok, thanks for your help.

Sidaf

Jun 22 '06 #3
sidaf wrote:
...
Sometimes I see functions written as followed:

SomeObject::SomeFunction() {
...
}

and then some written like this:

OtherObject::OtherFunction() {
...
};

What does the ; at the end mean?
...


Nothing. Moreover, since these are out-of-class member function
definitions, this ';' is simply illegal (although most compilers seem to
allow it).

--
Best regards,
Andrey Tarasevich
Jun 22 '06 #4

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

Similar topics

3
by: new_GUY | last post by:
I have a HUGE project (at least for me) and need some guidance. I am trying to create a database for a local university movie club that allows users to input there basic personal information...
7
by: Charles Crume | last post by:
Hello all; I have used dBASE, and other computer languages/databases, for years. They all have a logical field type. However, the version of MySQL used by the ISP hosting my site does not...
0
by: Matt | last post by:
Hello, I am attempting to get a software prototype UI/demo built in Flash to talk with existing C++ (so I can exchange data and commands between the application-software already developed in the...
6
by: hpy_awad | last post by:
please guide to C compiler in the download , the latest version of one but please do not tell me to have goggle search . Direct URL of fownload page please . Thanks in advance for your further help
2
by: Donal McWeeney | last post by:
Hi, Are there any good guidance white papers out there on the best way to design and build assemblys in VS.Net that would cover the following questions I have and requirements I know of: The...
2
by: Robert Hanson | last post by:
I am new to the asp.net application building and I have read the information regarding the storing of information using session vs cookies vs viewstate. I am asking for suggestions/guidance as to...
0
by: Patrick.O.Ige | last post by:
This what i got from microsoft! GDluck Dear ASP.NET Customer, This alert is to advise you of the availability of a web page that discusses an investigation Microsoft is currently conducting...
5
by: inetquestion | last post by:
I've got an xml doc which I'm using xslt to create a flat text configuration file. I need to make some dynamic changes in certain circumstances where some of the elements need to have others...
0
by: shinichi | last post by:
Hi all, Im an Oracle newbie here. I have questions here that need guidance from Oracle Expert here. Here it goes: - there are 3 databases that will be used: tableA (2000 records), tableAsub (45000...
0
by: darius | last post by:
Hi, having gps navigation web pages I am still curious about voice guidance algorithms/ applications incorporated into navigation systems. I would appreciate your guidance in accessing the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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
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
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...

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.