Hello
I have a program as given in following,
class CCmdValue
{
int a, b;
void Put(int x, int y) { a = x; c = y;}
};
class CCmdData
{
CCmdValue pValue;
pValue->Put(10, 20);
CCmdModule pCmd;
pCmd.NewValues( pValue);
};
class CCmdModule
{
friend class CCmdModuleFacto ry;
CCmdValue mValue;
};
class CCmdModuleFacto ry
{
CCmdModule& NewValues(CCmdV alue& pValue)
{
CCmdModule* p = new CCmdModule;
p->mValue = pValue; // THIS LINE FAILS
}
};
When i try to pass the value of "pValue" to "mValue" It fails. It
doesn't give any compilation error, but when i try to read the integer
values, they don't have any vlaues assigned to them.
Any idea why thats happening?
Thanks in advance. 2 1341
Donos wrote:
Hello
I have a program as given in following,
class CCmdValue
{
int a, b;
void Put(int x, int y) { a = x; c = y;}
};
This class has no public methods, so you can't really do anything with
it other than default construct, copy construct, or assign it.
>
class CCmdData
{
CCmdValue pValue;
pValue->Put(10, 20);
This should give a compile-time error.
CCmdModule pCmd;
pCmd.NewValues( pValue);
};
class CCmdModule
{
friend class CCmdModuleFacto ry;
CCmdValue mValue;
};
class CCmdModuleFacto ry
{
CCmdModule& NewValues(CCmdV alue& pValue)
{
CCmdModule* p = new CCmdModule;
p->mValue = pValue; // THIS LINE FAILS
}
};
When i try to pass the value of "pValue" to "mValue" It fails. It
doesn't give any compilation error, but when i try to read the integer
values, they don't have any vlaues assigned to them.
Any idea why thats happening?
How about providing a minimal, compilable, executable sample that
exhibits the behavior in question?
"Donos" <do******@gmail .comwrote in message
news:11******** *************@2 2g2000hsm.googl egroups.com...
Hello
I have a program as given in following,
class CCmdValue
{
int a, b;
void Put(int x, int y) { a = x; c = y;}
};
class CCmdData
{
CCmdValue pValue;
pValue->Put(10, 20);
CCmdModule pCmd;
pCmd.NewValues( pValue);
};
class CCmdModule
{
friend class CCmdModuleFacto ry;
CCmdValue mValue;
};
class CCmdModuleFacto ry
{
CCmdModule& NewValues(CCmdV alue& pValue)
{
CCmdModule* p = new CCmdModule;
p->mValue = pValue; // THIS LINE FAILS
}
};
When i try to pass the value of "pValue" to "mValue" It fails. It
doesn't give any compilation error, but when i try to read the integer
values, they don't have any vlaues assigned to them.
Any idea why thats happening?
Doing almost anything with these classes as they are shown here will give
compile time errors, since nothing is declared public. Everything is
private to each of the classes. Also, there are syntax errors. CCmdValue
pValue; is an instance. Yet you use it as a pointer, which would produce an
error.
Please show the actual code that is causing the problem. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Andy Read |
last post by:
Dear all,
I thought I understood passing parameters ByVal and ByRef but I
clearly don't! If I define a simple class
of:
Public Class Person
Public Name as String
Public Age as Integer
End Class
|
by: Arsen Vladimirskiy |
last post by:
Hello,
If I have a few simple classes to represent Entities such as Customers and
Orders.
What is the proper way to pass information to the Data Access Layer?
1) Pass the actual ENTITY to the Data Access Layer method
-or-
2) Pass some kind of a unique id to the Data Access Layer method
|
by: Ron Rohrssen |
last post by:
I want to show a dialog and when the form (dialog) is
closed, return to the calling form. The calling form
should then be able to pass the child form to another
object with the form as a parameter.
For example,
FormOptions formOptions = new FormOptions();
if (formOptions.ShowDialog(this) == DialogResult.OK)
{
|
by: rick |
last post by:
Does anyone having a working example of passing values
between web forms pages? I tried the example in the ms-
help but I can't get by the following:
To read property values from the source page in the call
page.
1. Create a global instance varible that is typed to the
class of the source page.
the sample provided
|
by: Ken Allen |
last post by:
I have a .net client/server application using remoting, and I cannot get the
custom exception class to pass from the server to the client. The custom
exception is derived from ApplicationException and is defined in an assembly
common to the client and server components. The custom class merely defines
three (3) constructors -- the null...
| |
by: Greg Merideth |
last post by:
I ran into a small snag in passing in a class as a parameter to a web
method from our calling code.
Now, we routinely pass *back* as a return value from a method, a class
reference and that works just fine, it just seems we can't pass *to* a
web method a class as a parameter.
Here's what I mean
webserver -> monitor.asmx
|
by: Stan |
last post by:
There are two ways to pass structured data to a web service:
xml
===
<Order OrderId="123" OrderAmount="234" />
or class
=====
|
by: Ross McLean |
last post by:
Hi all,
I've been teaching myself C# for a new project at work. I have a bit of
a background in c++ and java but never been what you could call a guru.
I'm having some strange things happening when I pass a class as a
parameter to a Windows Form. Basically, I have a class that has several
fields, two of these fields are an instance of an...
|
by: Markus Ernst |
last post by:
Hello
A class that composes the output of shop-related data gets some info
from the main shop class. Now I wonder whether it is faster to store the
info in the output class or get it from the main class whenever it is
needed:
class shop_main {
var $prices = null;
function &get_prices() {
|
by: TS |
last post by:
I was under the assumption that if you pass an object as a param to a method
and inside that method this object is changed, the object will stay changed
when returned from the method because the object is a reference type?
my code is not proving that. I have a web project i created from a web
service that is my object:
public class...
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
| |
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...
|
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. ...
|
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...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
|
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...
|
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...
| |
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: 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...
| |