Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Functions and references

Functions and references

Scheduled Pinned Locked Moved C#
csharphelpquestionannouncement
5 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    surgeproof
    wrote on last edited by
    #1

    i have two classes, one serverCommands and one socketServer. once i have created a new instance of the serverCommands class in socketServer, i want to be able to type something like serv (my new instance of serverCommands) .CreateSocket(socketName) and create a socket according to the name specified. is this possible? :confused: if so, how? this could be used with other stuff two as there is some things that would be much quicker to create with a function. should the functions be private, public, static or what? (and what do they mean? :-O) also is it possible to say something like Console.WriteLine(serv.Version()); and have it getting an output from the function Version and displaying it in the Console? i understand references have something to do with this, and returns...:~ :rolleyes: thanks for help with any of the above, surgeproof:) ------------------------------------------------------- ithium is the best. 'Science without religion is lame, religion without science is blind.' --Albert Einstein 'The pioneers of a warless world are the youth who refuse military service.' --Albert Einstein

    H 1 Reply Last reply
    0
    • S surgeproof

      i have two classes, one serverCommands and one socketServer. once i have created a new instance of the serverCommands class in socketServer, i want to be able to type something like serv (my new instance of serverCommands) .CreateSocket(socketName) and create a socket according to the name specified. is this possible? :confused: if so, how? this could be used with other stuff two as there is some things that would be much quicker to create with a function. should the functions be private, public, static or what? (and what do they mean? :-O) also is it possible to say something like Console.WriteLine(serv.Version()); and have it getting an output from the function Version and displaying it in the Console? i understand references have something to do with this, and returns...:~ :rolleyes: thanks for help with any of the above, surgeproof:) ------------------------------------------------------- ithium is the best. 'Science without religion is lame, religion without science is blind.' --Albert Einstein 'The pioneers of a warless world are the youth who refuse military service.' --Albert Einstein

      H Offline
      H Offline
      Heath Stewart
      wrote on last edited by
      #2

      This is all possible if you design your application right. It's your implementation. As far as the access modifiers, you need to decide if you want any class to be able to call a method or get/set a property or not. You can see the differences between the access modifiers by reading Access Modifiers[^] in the Visual C# product documentation.

      Microsoft MVP, Visual C# My Articles

      S 1 Reply Last reply
      0
      • H Heath Stewart

        This is all possible if you design your application right. It's your implementation. As far as the access modifiers, you need to decide if you want any class to be able to call a method or get/set a property or not. You can see the differences between the access modifiers by reading Access Modifiers[^] in the Visual C# product documentation.

        Microsoft MVP, Visual C# My Articles

        S Offline
        S Offline
        surgeproof
        wrote on last edited by
        #3

        thanks for the link, it helps. would you have a link to teach me about functions/etc. and referencing? i can't seem to find anything useful, so if you do know of a good one please tell. thanks, surgeproof ------------------------------------------------------- ithium is the best. 'Science without religion is lame, religion without science is blind.' --Albert Einstein 'The pioneers of a warless world are the youth who refuse military service.' --Albert Einstein

        H 1 Reply Last reply
        0
        • S surgeproof

          thanks for the link, it helps. would you have a link to teach me about functions/etc. and referencing? i can't seem to find anything useful, so if you do know of a good one please tell. thanks, surgeproof ------------------------------------------------------- ithium is the best. 'Science without religion is lame, religion without science is blind.' --Albert Einstein 'The pioneers of a warless world are the youth who refuse military service.' --Albert Einstein

          H Offline
          H Offline
          Heath Stewart
          wrote on last edited by
          #4

          Nothing useful? How about reading the .NET Framework SDK[^] for starters, not to mention any number of the countless books out there about the .NET Framework and the languages that target it, like C#? It's how many of us learned.

          Microsoft MVP, Visual C# My Articles

          S 1 Reply Last reply
          0
          • H Heath Stewart

            Nothing useful? How about reading the .NET Framework SDK[^] for starters, not to mention any number of the countless books out there about the .NET Framework and the languages that target it, like C#? It's how many of us learned.

            Microsoft MVP, Visual C# My Articles

            S Offline
            S Offline
            surgeproof
            wrote on last edited by
            #5

            thanks. will try :) surgeproof ------------------------------------------------------- ithium is the best. 'Science without religion is lame, religion without science is blind.' --Albert Einstein 'The pioneers of a warless world are the youth who refuse military service.' --Albert Einstein

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups