Click here to Skip to main content
15,892,537 members
Home / Discussions / C#
   

C#

 
GeneralRe: Converting from Java to C# problem.. Pin
leppie31-Oct-02 6:09
leppie31-Oct-02 6:09 
GeneralRe: Converting from Java to C# problem.. Pin
Stephane Rodriguez.29-Oct-02 19:16
Stephane Rodriguez.29-Oct-02 19:16 
GeneralCreating DB's on the fly!!! Pin
Anonymous29-Oct-02 9:43
Anonymous29-Oct-02 9:43 
GeneralRe: Creating DB's on the fly!!! Pin
leppie29-Oct-02 10:19
leppie29-Oct-02 10:19 
GeneralRe: Creating DB's on the fly!!! Pin
perlmunger29-Oct-02 11:07
perlmunger29-Oct-02 11:07 
GeneralRe: Creating DB's on the fly!!! Pin
Anonymous29-Oct-02 12:13
Anonymous29-Oct-02 12:13 
GeneralRe: Creating DB's on the fly!!! Pin
Anonymous30-Oct-02 11:23
Anonymous30-Oct-02 11:23 
GeneralPie / Bar / Line Charts Pin
Anonymous29-Oct-02 9:40
Anonymous29-Oct-02 9:40 
GeneralRe: Pie / Bar / Line Charts Pin
Christian Graus29-Oct-02 15:34
protectorChristian Graus29-Oct-02 15:34 
GeneralDeterming SQL Server Type from C# Pin
perlmunger29-Oct-02 9:28
perlmunger29-Oct-02 9:28 
GeneralRe: Determing SQL Server Type from C# Pin
leppie29-Oct-02 10:23
leppie29-Oct-02 10:23 
GeneralRe: Determing SQL Server Type from C# Pin
perlmunger29-Oct-02 10:54
perlmunger29-Oct-02 10:54 
GeneralRe: Determing SQL Server Type from C# Pin
leppie29-Oct-02 11:05
leppie29-Oct-02 11:05 
GeneralRe: Determing SQL Server Type from C# Pin
perlmunger29-Oct-02 11:11
perlmunger29-Oct-02 11:11 
GeneralRe: Determing SQL Server Type from C# Pin
leppie29-Oct-02 11:39
leppie29-Oct-02 11:39 
GeneralRe: Determing SQL Server Type from C# Pin
Stephane Rodriguez.29-Oct-02 18:36
Stephane Rodriguez.29-Oct-02 18:36 
GeneralRe: Determing SQL Server Type from C# Pin
perlmunger30-Oct-02 9:07
perlmunger30-Oct-02 9:07 
GeneralPass By Reference Problem Pin
perlmunger29-Oct-02 6:34
perlmunger29-Oct-02 6:34 
I'm not sure what is going on here, but I hope there's someone who knows why this happens. Basically, I have a base class and an inherited class, something like this:

public abstract class Base {}
public class Inherited : Base {}


I also have a class that populates inherited objects called ObjectBuilder. It is a singleton and it has a method called PopulateObject. Here is the code to do what I want:
Inherited i = new Inherited();

ObjectBuilder ob = ObjectBuilder.GetInstance();

ob.PopulateObject( ref i );

// Do something with i


The problem is that the signature for PopulateObject takes a ref to Base. If I understand the is-a relationship properly, doing so should work and in fact, when I remove the 'ref' keyword from the declaration as well as implementation, it builds fine. It just won't work properly because it is at that point passing a copy (isn't it?). What is going on here? Why will it build without error when I pass a copy, but fails when I pass by reference?

Any help would be greatly appreciated.

-Matt

------------------------------------------

The 3 great virtues of a programmer:
Laziness, Impatience, and Hubris.
--Larry Wall
GeneralRe: Pass By Reference Problem Pin
Daniel Turini29-Oct-02 6:40
Daniel Turini29-Oct-02 6:40 
GeneralRe: Pass By Reference Problem Pin
perlmunger29-Oct-02 6:51
perlmunger29-Oct-02 6:51 
GeneralRe: Pass By Reference Problem Pin
leppie29-Oct-02 7:42
leppie29-Oct-02 7:42 
GeneralRe: Pass By Reference Problem Pin
perlmunger29-Oct-02 9:18
perlmunger29-Oct-02 9:18 
GeneralRe: Pass By Reference Problem Pin
LongRange.Shooter29-Oct-02 8:42
LongRange.Shooter29-Oct-02 8:42 
GeneralRe: Pass By Reference Problem Pin
perlmunger29-Oct-02 9:20
perlmunger29-Oct-02 9:20 
GeneralRe: Pass By Reference Problem Pin
Paul Ingles29-Oct-02 14:40
Paul Ingles29-Oct-02 14:40 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.