Results 1 to 1 of 1

Thread: Shared worker thread [VS 2013]

  1. #1

    Thread Starter
    New Member
    Join Date
    Sep 2014
    Posts
    10

    Shared worker thread [VS 2013]

    Ok, so I have a class with a shared method, Worker(), that runs in the background. It creates instances of itself in the process.

    If I inherit this class, I want for the worker method to create instances of the inherited class, not the base class. I thought I'd try using a shared Factory() function to return the correct instance, but shared methods can't be overridden, only shadowed. So calling Factory() from the worker thread always returns the base instance, not the inherited one.

    EDIT: Think I found a solution. I have to pass a delegate to the correct Factory() method when starting the worker thread, then invoke it.
    Last edited by jdlessl; Apr 12th, 2015 at 11:35 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width