c# - How do I access something from a virtual class so I can use them for If/Else statements in the MAIN class? -


class registration {     public virtual void register()     {         int registration_system;          console.write("registration system");         console.write("\n 1. add student" +                       "\n 2. view student" +                       "\n 3. search" +                       "\n 4. edit" +                       "\n 5. delete" +                       "\n 6. exit");         console.write("\nchoose: "); registration_system = int.parse(console.readline());     } }  class program //main class {     static void main(string[] args)     {         registration r = new registration();         r.register();         msit = new msit();         mscs cs = new mscs();        } } 

so need access registration_system's value in order use them in if/else system main class:

if (registration_system == 1) { } .. 

i'll doing @ least 6 other classes since missed couple of lessons. far need set skeleton if/else can access other classes can't without using registration_system's value. doing correctly though? there way?

what using return value of register function, this:

public virtual int register() {     ....     return registration_system; } 

Comments

Popular posts from this blog

curl - PHP fsockopen help required -

HTTP/1.0 407 Proxy Authentication Required PHP -

c# - Resource not found error -