Click here to Skip to main content
15,922,512 members
Home / Discussions / C#
   

C#

 
GeneralRe: Inherited Static Constructors Pin
moredip8-Mar-03 12:56
moredip8-Mar-03 12:56 
GeneralRe: Inherited Static Constructors Pin
leppie8-Mar-03 13:14
leppie8-Mar-03 13:14 
GeneralRe: Inherited Static Constructors Pin
moredip8-Mar-03 13:43
moredip8-Mar-03 13:43 
GeneralRe: Inherited Static Constructors Pin
moredip8-Mar-03 13:53
moredip8-Mar-03 13:53 
GeneralRe: Inherited Static Constructors Pin
moredip8-Mar-03 14:10
moredip8-Mar-03 14:10 
GeneralRe: Inherited Static Constructors Pin
leppie8-Mar-03 14:25
leppie8-Mar-03 14:25 
GeneralRe: Inherited Static Constructors Pin
moredip8-Mar-03 16:05
moredip8-Mar-03 16:05 
GeneralRe: Inherited Static Constructors Pin
leppie9-Mar-03 7:02
leppie9-Mar-03 7:02 
moredip wrote:
I don't think I am using instance-specific data, only class-specific.

Inheritance is just not an option then...

What you want to design is numerous singleton classes each doing it own thing, BUT you want all the benefits of inheritance (which we have said will not work).

moredip wrote:
All you need for a Delete is a tableName and a PKName, right? And that isn't instance specific, it's class-specific.

Place that function in a util class as a static method then passing the tablename and pk value.

moredip wrote:
So I don't see why C# won't let me create a base class static function Delete() which uses a different value for a static variable depending on what the instantiating class is.

Youre contradicting yourself here. placing static and instance in the same sentence is unsafe. Just think about it, if you have a static function say Class.Delete() , what is it suppose to delete??? I assume these classes are mapped to a table or a record. What happens if you have 2 records open at the same time, which one is meant to get deleted?

moredip wrote:
When you say "you want to use a single value to store 3 different values. That is just impossible" I disagree. If you think about it, it's no different than using one method signature to refer to 3 different methods depending on the invoking object's class. The difference is that it's a string rather than a function pointer, and that the polymorphism can be resolved at compile-time, not run-time (I think...).

OK I should have rather said, pointing all to one address then. Strings are infact stored as pointers.

moredip wrote:
Hmm, I think this could all be academic anyway, if C# can't do it then it can't do it. It just seems ugly to me to create a non-static variable that doesn't use any instance-specific data.

Then you will have to boot an OO approach and follow the C approach using C style parameterized functions. Which will probably much easier doin git in C/C++. Did you look at my code though (i didnt mean copy)? I run into similar issues, hence using an instance design. No I have no problem if you create classes for a Table as well , but that would be unnecesary using an instance approach. These table classes would have a static Delete fucntion, but would need at least need one parameter but you would lose inheritance thus losing the abilty to cast and use base classes's methods. And interfaces.

I rated this article 2 by mistake. It deserves more. I wanted to get to the second page... - vjedlicka 3:33 25 Nov '02
GeneralRe: Inherited Static Constructors Pin
moredip9-Mar-03 7:26
moredip9-Mar-03 7:26 
GeneralRe: Inherited Static Constructors Pin
leppie9-Mar-03 7:54
leppie9-Mar-03 7:54 
GeneralTextBox DataBinding Pin
leppie8-Mar-03 7:24
leppie8-Mar-03 7:24 
GeneralRe: TextBox DataBinding Pin
leppie8-Mar-03 7:31
leppie8-Mar-03 7:31 
GeneralDocking Problem Pin
Mazdak8-Mar-03 7:02
Mazdak8-Mar-03 7:02 
GeneralRe: Docking Problem Pin
leppie8-Mar-03 7:19
leppie8-Mar-03 7:19 
GeneralRe: Docking Problem Pin
Mazdak8-Mar-03 8:15
Mazdak8-Mar-03 8:15 
GeneralRe: Docking Problem Pin
leppie8-Mar-03 8:25
leppie8-Mar-03 8:25 
GeneralRe: Docking Problem Pin
Roger Alsing8-Mar-03 11:33
Roger Alsing8-Mar-03 11:33 
GeneralRe: Docking Problem Pin
leppie8-Mar-03 12:08
leppie8-Mar-03 12:08 
GeneralRe: Docking Problem Pin
Mazdak8-Mar-03 17:53
Mazdak8-Mar-03 17:53 
QuestionAnything Like MFC's CWinThread in C#? Pin
Xytme8-Mar-03 6:33
Xytme8-Mar-03 6:33 
AnswerRe: Anything Like MFC's CWinThread in C#? Pin
Mazdak8-Mar-03 7:04
Mazdak8-Mar-03 7:04 
QuestionAnything Like MFC's CWinThread in C#? Pin
Xytme8-Mar-03 6:33
Xytme8-Mar-03 6:33 
AnswerRe: Anything Like MFC's CWinThread in C#? Pin
David Stone8-Mar-03 6:44
sitebuilderDavid Stone8-Mar-03 6:44 
QuestionIs there anything like MFC's CWinThread in C#? Pin
Xytme8-Mar-03 6:31
Xytme8-Mar-03 6:31 
QuestionIs there anything like MFC's CWinThread in C#? Pin
Xytme8-Mar-03 6:30
Xytme8-Mar-03 6:30 

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.