CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com

Search:

Type: Posts; User: Eggman002

Page 1 of 5 1 2 3 4

Search: Search took 0.04 seconds.

  1. Replies
    8
    Views
    1,108

    Re: Function overloading with inherited types

    User's of the library consist of me. So that isn't really an issue.

    Lets just forget about whether I could use the existing event system or not. As mentioned I have other reasons why I want to...
  2. Replies
    8
    Views
    1,108

    Re: Function overloading with inherited types

    You can control when it gets fired in the existing system. But suppose you want a system where all events get fired at the same time. So in my system for example I want to be able to check for...
  3. Replies
    8
    Views
    1,108

    Re: Function overloading with inherited types

    At the moment I only have one type of event but the plan is obviously to have more.

    The exact types are yet to be determined but they could be pretty much anything (ButtonPressed, KeyPressed,...
  4. Replies
    8
    Views
    1,108

    Function overloading with inherited types

    Here is what I want:



    interface IEvent
    {
    ...
    }

    class EventType1 : IEvent
  5. Replies
    35
    Views
    5,679

    Re: Multiple Inheritance and Casting

    Actually I think I understand a way that I can use this technique now that I have thought about it a bit. As per my previous example if I have a SpecialModeCommon, then I can use the...
  6. Replies
    35
    Views
    5,679

    Re: Multiple Inheritance and Casting

    Okay looking in further detail at the Double Dispatch idea, I still don't really see how I can make use of it. At least not with the current code base (which I am stuck with).

    Looking at the...
  7. Replies
    35
    Views
    5,679

    Re: Multiple Inheritance and Casting

    Sorry, I am not overly familiar with the concept of Double Dispatch. I Googled it but I am not really sure how it would apply here.
  8. Replies
    35
    Views
    5,679

    Re: Multiple Inheritance and Casting

    There is no runtime checking of types happening here. That was not clear in the sample. There is runtime checking of a flag which indicates which mode we are currently in.

    Though the flag is not...
  9. Replies
    35
    Views
    5,679

    Re: Multiple Inheritance and Casting

    So I am revisiting this issue and I wonder what people think about the following solution. Is it appropriate? Is it good design?

    To avoid multiple inheritance, I use the following setup:


    ...
  10. Replies
    35
    Views
    5,679

    Re: Multiple Inheritance and Casting

    What about when implementing the method on the class doesn't make sense (or is impossible). For example what if you are inheriting from a class where you don't have the source (i.e. from a code...
  11. Replies
    35
    Views
    5,679

    Re: Multiple Inheritance and Casting

    The problem with that solution (unless I am missing something) is that I then have to do the following:




    if(Verify we are in SpecialModeType1)
    {
    SpecialModeType1* mode =...
  12. Replies
    35
    Views
    5,679

    Re: Multiple Inheritance and Casting

    Well suffice it to say that I didn't write all the code, I just have to modify it.

    So in my example, Mode, ModeType1, ModeType2 and ModeManager are written by someone else and can not be easily...
  13. Replies
    35
    Views
    5,679

    Re: Multiple Inheritance and Casting

    That was just due to a sloppy rewrite of the code. I was using public.

    As for the rest of the comments, that is sort of what I figured and yet I am not sure there is a nice way to change around...
  14. Replies
    35
    Views
    5,679

    Multiple Inheritance and Casting

    I have a circumstance where multiple inheritance is required. I have a class layout something like the following.




    class Mode
    {

    }
  15. Replies
    11
    Views
    1,414

    Re: Generic Methods without Where

    Brilliant. That was the trick. I am pretty sure that is why JonnyPoet's solution also worked because he was storing a list of objects rather than MyObject. But the casting to Object first does the...
  16. Replies
    11
    Views
    1,414

    Re: Generic Methods without Where

    No it doesn't have to be derived from MyObject. Certainly the objects in the list have to be derived from MyObject, but T could be anything.

    So I might have:



    class MyComparableObject :...
  17. Replies
    11
    Views
    1,414

    Re: Generic Methods without Where

    Not sure what you mean by that. Can you elaborate?
  18. Replies
    11
    Views
    1,414

    [RESOLVED] Generic Methods without Where

    Suppose I have a class that has a collection. I want to make a generic method to access certain types of objects within that collection. Basically what I want is:



    class MyCollection
    {
    ...
  19. DataContractSerializer - Passing Serialization Context

    The Binary Serializer has support for passing data to the Serialization Context.

    I am using the DataContract Serializer and I would like to do the same thing.

    Specifically, I want to be able to...
  20. Replies
    9
    Views
    1,494

    Re: Safe Handling of Timers

    Doing it on Dispose is fine, so long as I can ensure that the control is disposed. Simply closing the form does not seem to necessarily call the dispose method.

    I could call dispose from the...
  21. Replies
    9
    Views
    1,494

    Re: Safe Handling of Timers

    Okay, so using:



    this.ParentForm.FormClosing += StopTimer;


    I am able to ensure the timer gets stopped. However, the issue now is that in order to attach this callback, I had to do a hack...
  22. Replies
    9
    Views
    1,494

    Re: Safe Handling of Timers

    The problem is that the timer is part of a User Control not a Form, so in the context where the timer exists, it doesn't know about the form.

    Unless I can do something like:

    this.ParentForm
  23. Replies
    9
    Views
    1,494

    Safe Handling of Timers

    I need to know if there is a safe way to handle timers in a Component.

    Specifically, I need to ensure the timer is stopped and destroyed.

    If I have a User Control:



    class MyControl :...
  24. DataContractSerializer - Controlling Output

    I am working with the DataContractSerializer and I would like to know if it is possible to control the output a bit more.

    Right now, I am getting a bunch of namespace references like d4p1 etc.
    ...
  25. Re: Meaningful representation of Quaternions

    Well perhaps some more information would get a response.

    First, I am working in C# using DX 9.

    I have found the following math:




    yaw = Math.Atan2(2*qt.Y*qt.W - 2* qt.X*qt.Z, 1 -...
Results 1 to 25 of 112
Page 1 of 5 1 2 3 4





Click Here to Expand Forum to Full Width

Featured