Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7057395
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T03:58:51+00:00 2026-05-28T03:58:51+00:00

I want to be able to create a method that I can call like

  • 0

I want to be able to create a method that I can call like a static class in my game so I can move the sprites for example:

Code

functions.move(Vector2Position)

The problem is that I can’t use Instance Constructors in a static method. Is there any way of doing this or will I have to do something else?

EDIT :

I need to be able to call this outside the current class.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T03:58:52+00:00Added an answer on May 28, 2026 at 3:58 am

    Have a look at Static Constructors and Static Classes on MSDN. In short:

    You can declare a static class using the “static” keyword. This indicates that a class cannot be instantiated. Note that a static method can exist in normal classes too, not just ones marked “static”.

    static class MyClass
    {
        private static int value;
        public static int GetValue() { return value; }
    }
    

    You can have a static constructor if you need to initialize the class in any way:

    // Static constructor
    static MyClass()
    {
        value = 1;
    }
    

    You would then call the method with the code below. This could be done anywhere – within any other static or instance method.

    int someValueSomewhere = MyClass.GetValue();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to be able to create links looking like buttons with dynamic text
I want to be able to create modal dialogs, with, for example close: function()
In Delphi, I want to be able to create an private object that's associated
I have a class that I want to be able the handle the mouse
I want to create a handler that can be used to handle any event
I want to be able to create a GUID/UUID on the iPhone and iPad.
I want to be able to create an email message with an attachment, but
I want to be able to create a temporary text File in Java to
I want to be able to create the XSD file for my typed dataset
I want to be able to create a KPI List on my MOSS 2007

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.