Here's the problem:
I have a function that references another one in this manner:
class circleType: public pointType
so, pointType is redefined by circleType, thereby giving circleType access
to all the functions in pointType if need-be. Here is the function I am
using in pointType:
void pointType::setC oords(double xCoord, double yCoord)
{
pointX = xCoord;
pointY = yCoord;
}
it is being accessed in circleType in this manner:
void circleType::get Coords(double xCoord, double yCoord)
{
//set the external point using the pointType header
pointType::setC oords(pointX, pointY);
cout << "The coordinate entered is: (" << pointX << "," << pointY << ")";
cout << endl;
}
My cout works, but the point it prints is (0,0), meaning that the variables
aren't being passed into the function, and it is just defaulting to the
value of 0 for both.
Any thoughts? 4 1495
deanfamily wrote: Here's the problem: I have a function that references another one in this manner: class circleType: public pointType so, pointType is redefined by circleType, thereby giving circleType access to all the functions in pointType if need-be. Here is the function I am using in pointType:
void pointType::setC oords(double xCoord, double yCoord) { pointX = xCoord; pointY = yCoord; }
it is being accessed in circleType in this manner:
void circleType::get Coords(double xCoord, double yCoord) { //set the external point using the pointType header pointType::setC oords(pointX, pointY); cout << "The coordinate entered is: (" << pointX << "," << pointY << ")"; cout << endl; }
My cout works, but the point it prints is (0,0), meaning that the variables aren't being passed into the function, and it is just defaulting to the value of 0 for both.
Any thoughts?
Code isn't very descriptive but seem as though you're passing
uninitialized member variables of the pointType to PointType:
void circleType::get Coords(double xCoord, double yCoord)
{
//set the external point using the pointType header
pointType::setC oords(pointX, pointY);
....
did you mean: pointType::setC oords(xCoord, yCoord) ?
Even with it corrected to
void circleType::get Coords(double xCoord, double yCoord)
{
//set the external point using the pointType header
pointType::setC oords(xCoord, yCoord);
cout << "The coordinate entered is: (" << pointX << "," << pointY << ")";
cout << endl;
}
it still isn't passing the amounts.
"puzzlecrac ker" <ir*********@gm ail.com> wrote in message
news:11******** *************@f 14g2000cwb.goog legroups.com... deanfamily wrote: Here's the problem: I have a function that references another one in this manner: class circleType: public pointType so, pointType is redefined by circleType, thereby giving circleType access to all the functions in pointType if need-be. Here is the function I am using in pointType:
void pointType::setC oords(double xCoord, double yCoord) { pointX = xCoord; pointY = yCoord; }
it is being accessed in circleType in this manner:
void circleType::get Coords(double xCoord, double yCoord) { //set the external point using the pointType header pointType::setC oords(pointX, pointY); cout << "The coordinate entered is: (" << pointX << "," << pointY << ")"; cout << endl; }
My cout works, but the point it prints is (0,0), meaning that the variables aren't being passed into the function, and it is just defaulting to the value of 0 for both.
Any thoughts? Code isn't very descriptive but seem as though you're passing uninitialized member variables of the pointType to PointType:
void circleType::get Coords(double xCoord, double yCoord) { //set the external point using the pointType header pointType::setC oords(pointX, pointY);
....
did you mean: pointType::setC oords(xCoord, yCoord) ?
deanfamily wrote: Here's the problem: I have a function that references another one in this manner: class circleType: public pointType
This means nothing. Be careful to use the correct terms for the
concepts. What's more, some code is worth a thousand words, so they
say.
so, pointType is redefined by circleType, thereby giving circleType access to all the functions in pointType if need-be. Here is the function I am using in pointType:
void pointType::setC oords(double xCoord, double yCoord) { pointX = xCoord; pointY = yCoord; }
it is being accessed in circleType in this manner:
void circleType::get Coords(double xCoord, double yCoord)
get or set?
{ //set the external point using the pointType header pointType::setC oords(pointX, pointY); cout << "The coordinate entered is: (" << pointX << "," << pointY << ")"; cout << endl; }
My cout works, but the point it prints is (0,0), meaning that the variables aren't being passed into the function, and it is just defaulting to the value of 0 for both.
Something on line 42, perhaps?
Seriously, the code you gave is obviously correct, so some wild
guesses:
1) circleType also has members named pointX and pointY which takes
precedence over pointType's in the std::cout
2) you passed 0,0 when you called getCoords (or setCoords?)
3) another thread modify the variables
4) main returns void
5) you have a virus
What does the debugger says? Is there more code to this program?
Something we could test ourselves?
Jonathan
deanfamily wrote: Even with it corrected to void circleType::get Coords(double xCoord, double yCoord) { //set the external point using the pointType header pointType::setC oords(xCoord, yCoord); cout << "The coordinate entered is: (" << pointX << "," << pointY << ")"; cout << endl; } it still isn't passing the amounts.
"puzzlecrac ker" <ir*********@gm ail.com> wrote in message news:11******** *************@f 14g2000cwb.goog legroups.com... deanfamily wrote: Here's the problem: I have a function that references another one in this manner: class circleType: public pointType so, pointType is redefined by circleType, thereby giving circleType access to all the functions in pointType if need-be. Here is the function I am using in pointType:
void pointType::setC oords(double xCoord, double yCoord) { pointX = xCoord; pointY = yCoord; }
it is being accessed in circleType in this manner:
void circleType::get Coords(double xCoord, double yCoord) { //set the external point using the pointType header pointType::setC oords(pointX, pointY); cout << "The coordinate entered is: (" << pointX << "," << pointY << ")"; cout << endl; }
My cout works, but the point it prints is (0,0), meaning that the variables aren't being passed into the function, and it is just defaulting to the value of 0 for both.
Any thoughts? Code isn't very descriptive but seem as though you're passing uninitialized member variables of the pointType to PointType:
void circleType::get Coords(double xCoord, double yCoord) { //set the external point using the pointType header pointType::setC oords(pointX, pointY);
....
did you mean: pointType::setC oords(xCoord, yCoord) ?
I second it. Perhaps, computer science is not really for you. Can you
still change the major? This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Randell D. |
last post by:
Folks,
I've asked this before but never got any response but its important and I
thought I'd pitch it again (hopefully a bit clearer)...
One can pass data from one function to another either by passing a copy, or
passing by reference.
My understanding of passing by reference (putting the & before a variable
during the function declaration) means that the original data is used.
|
by: J.R. |
last post by:
Hi folks,
The python can only support passing value in function call (right?), I'm
wondering how to effectively pass a large parameter, such as a large list or
dictionary?
It could achieved by pointer in C++, is there such way in Python?
Thansk in advance.
J.R.
|
by: drec |
last post by:
I am creating a search box that the user types a value in, and then
this gets passed to another page called search.php
I would like to be able to pass these values through the URL, but I
cant seem to figure out how. Right Now I have a simple html form that
passes the value through posting, which I can then pull with a
$_POST. But I need to have this value be passed through URL.
|
by: tshad |
last post by:
I want to access multiple arguments based on name passed.
For example I have the following asp:textboxes:
BillingAddress1
BillingAddress2
BillingCity
ShippingAddress1
ShippingAddress2
ShippingCity
|
by: laredotornado |
last post by:
Hi,
I want to pass my function
myFunc('a', 'b', 'c')
as an argument to another function. However, this will not work
doStuff('x', 'y', myFunc('a', 'b', 'c'))
| |
by: arunmib |
last post by:
hi all,
I just got this freaky kind of doubt....I have the following piece of code,
int main()
{
int Val= 10, *ptr;
ptr = &Val;
TestFn(&Val);
|
by: lisp9000 |
last post by:
I've read that C allows two ways to pass information between
functions:
o Pass by Value
o Pass by Reference
I was talking to some C programmers and they told me there is no such
thing as pass by reference in C since you are just passing an address
(or a pointer value address I guess?). So I was wondering is this
correct?
|
by: Bryan Parkoff |
last post by:
I write my large project in C++ source code. My C++ source code
contains approximate four thousand small functions. Most of them are
inline. I define variables and functions in the global scope. The global
variables and global functions are hidden to prevent from accessing by the
programmers. All global functions share global variables.
Only very few global functions are allowed to be reusability for the
programmers to use. Few...
|
by: magickarle |
last post by:
Hi, I got a pass-through query (that takes about 15 mins to process)
I would like to integrate variables to it.
IE: something simple:
Select EmplID from empl_Lst
where empl_lst.timestamp between !! And
!!
Not sure how to do so (should it be a query in Access or a macro)
The connection would be ODBC.
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |