Alright So I want to know when looking at the code below:

every so often with each method argument there is an "identifier" starting with the first one: "Inside() , Show(), Outside(), Display() " I know the names can be made up literally but what do the parenthesis signify ?

Second question:

Recto.Display();

what exactly is recto more importantly "recto.display(); " mean surprisingly the web has no definition , i only see it shown up in examples on the web no mention of it whatsoever

My Last Question is "return 0" is basically the void type but instead returns integer values right ?

public class Outside
{
    public class Inside 
    {
        public static string InMessage;

        public Inside()
        {
            Console.WriteLine(" _= Insider =_");
            InMessage = "Sitting inside while it's raining";

        }

        public static void Show()
        {
            Console.WriteLine("Show me the wonderful world of C# Programming");
        }
    }
    public Outside()
    {
        Console.WriteLine("=_ The Parent _=");

    }
    public void Display()
    {
        Console.WriteLine(Inside.InMessage);
        Inside.Show();
    }

 }
class Exercise
{ 
    static int Main()
    {
        Outside Recto = new Outside();
        Outside.Inside Ins = new Outside.Inside();

        Recto.Display();
        return 0;
    }
}

Thank you so much everyone, again for all your help! This really means a lot too me!

Recommended Answers

All 4 Replies

P.S forgot to add what would "Inside.Show(); " do does it have to do with anything with the final result and output?

To me this line of code is useless:
Outside.Inside Ins = new Outside.Inside();
As its just declaring a new object of a class that is in a class. Dunno why you would have a class inside a class like that.
Inside. Show() would display this: Show me the wonderful world of C# Programming.
upvote if it helps:)

The () signify that this is a method. Without the (), in C# at least, it's a property (lower case property, upper case Property has a different meaning).

Recto is an instance variable. It holds an instance of the Outside class. Recto.Display() is a call to the method Display of the instance variable Recto.

return tells a method that the method is done processing. For void type methods, nothing can be specified after the return. For other types (int in this example) it is required to return a 'value' of that type. It is standard convention in command line programs to return 0 (zero) to indicate that the program ran successfully. Technically void is not a type, it is nothing (in C#, other languages use void as a type).

Inside.Show() would display the text "Show me the wonderful world of C# Programming" to the console.

Yes, it has something to do with the final output as the method Display() of the Outside class calls it.

commented: easy detailed explanations +1

Thanks Momerath as always!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.