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

I've Got A problem On Referencing Functions

Hello all u guys out there

Ive got a problem Undrestanding in example what it means

class point
{
....
}
point &function1()
{
point sample;
return sample;
}

whats meaning of & in a function??

Tank you

Jun 24 '06 #1
4 1166
* im*************@gmail.com:
Hello all u guys out there
"you"

Ive got a problem Undrestanding in example what it means
missing apostrophe, uppercase U, "understanding"

class point
{
...
}
missing semicolon

point &function1()
{
point sample;
return sample;
}
for a newbie this function constitutes an error

whats meaning of & in a function??


missing apostrophe, extranous question mark

the meaning of "&" depends on the context; consult your nearest C++
textbook.

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Jun 24 '06 #2
Alf P. Steinbach wrote:
* im*************@gmail.com:
Hello all u guys out there

"you"

Not all of us sit on bonfires on the 5th of November...

--
Ian Collins.
Jun 24 '06 #3
* Ian Collins:
Alf P. Steinbach wrote:
* im*************@gmail.com:
Hello all u guys out there


"you"

Not all of us sit on bonfires on the 5th of November...


:-)

Actually our bonfire night, in Norway, is tonight, 23/24th of June,
midsummer's night!

One bonfire got a little out of hand this year (it was probably
calculated using C instead of C++): <url:
http://www.aftenposten.no/nyheter/iriks/article1365611.ece>. The guy on
the left in the upper photo is probably the one who sat on top.

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Jun 24 '06 #4
i'm not good in english...
then accept my Apologize

in example in file below if you clean & before operator you got an
error
why it couldn't answer when we erase & ?

//phonenumber.h

#ifndef PHONENUMBER_H
#define PHONENUMBER_H

#include <iostream>
using std::ostream;
using std::istream;

#include <string>
using std::string;

class PhoneNumber
{
friend ostream &operator<<( ostream &, const PhoneNumber & );
friend istream &operator>>( istream &, PhoneNumber & );
private:
string areaCode; // 3-digit area code
string exchange; // 3-digit exchange
string line; // 4-digit line
}; // end class PhoneNumber

#endif

----------------
//PhoneNumber.cpp

#include <iomanip>
using std::setw;

#include "PhoneNumber.h"

// overloaded stream insertion operator; cannot be
// a member function if we would like to invoke it with
// cout << somePhoneNumber;
ostream &operator<<( ostream &output, const PhoneNumber &number )
{
output << "(" << number.areaCode << ") "
<< number.exchange << "-" << number.line;
return output; // enables cout << a << b << c;
} // end function operator<<

// overloaded stream extraction operator; cannot be
// a member function if we would like to invoke it with
// cin >> somePhoneNumber;
istream &operator>>( istream &input, PhoneNumber &number )
{
input.ignore(); // skip (
input >> setw( 3 ) >> number.areaCode; // input area code
input.ignore( 2 ); // skip ) and space
input >> setw( 3 ) >> number.exchange; // input exchange
input.ignore(); // skip dash (-)
input >> setw( 4 ) >> number.line; // input line
return input; // enables cin >> a >> b >> c;
} // end function operator>>

Tanx

Jun 24 '06 #5

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

Similar topics

2
by: Simon | last post by:
Am using the following code. <script language="JavaScript1.2"> function setquantity(productindex,productquantity) { //create the reference object irefname_none = eval("document." +...
11
by: Milind | last post by:
Hi, I was trying to implement a composition relation, somthing of the following type: class A { public: class B {
1
by: Geir Baardsen | last post by:
Hi! I had some thoughts on creating a dll-file in Delphi 7, and have this dll contain some functions to use in my access 2000 db. How do I call the dll-file from within my access 2000 db? Anybody...
2
by: Sean Mullaly | last post by:
I have a custom Access menu with sub-menus and sub-sub-menus. (220 items). Right now I have created 220 Functions and attached each individual Function to the specific OnAction property. The...
11
by: Edd | last post by:
Hello all, I've made a data structure and an associated set of functions to enable me to store a dynamically-sized array of elements of whatever data type I like. Well that's the idea anyway......
4
by: Oenone | last post by:
Another VB6 feature that I'm missing in VB.NET is with regard to referencing projects vs. referencing DLLs. In VB6 I can reference my support library, Support.dll, and call its functions. If...
9
by: Brett Romero | last post by:
Say I have a library (A.dll) with a method that accepts a collection of a specific type. The type is defined in B.dll. In A.dll, I need to loop through this collection and reference fields of...
3
by: SR | last post by:
I need to use a string replace function in my XSL document. I found a W3 library that has numerous string functions such as fn:replace(). When I try using the namespace, I get an error "Cannot...
0
by: DahrkDaiz | last post by:
Ok so I have a base class and several inherited classes. The base class has 3 Delegate Objects so that the inherited classes can redefine search functions (note, virtual will not work in this case)....
2
by: =?Utf-8?B?SmFtZXMgUGFnZQ==?= | last post by:
Hi all I have a user control - mycontrol.ascx with various controls within it. mycontrol.ascx is utilised in myPage.aspx I have a class (class1) to carry out various functions, subs etc. How...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

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.