c# overlapping class question!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Asked 2 weeks ago, Updated 2 weeks ago, 1 views

using System;

class line
{
    Public class point // What is the reason why public should be included in this part?
    {
        public int x;
    }
    public point starting = new point();
}
class C_sharp_book
{
    public static void Main()
    {
        line mine = new line();

        mine.starting.x = 3;
        Console.WriteLine("{0}", mine.starting.x);
    }
}

I've put a question on the comment!

c#

2022-09-20 08:42

1 Answers

mine.starting.x = 3; This direct access to class member variables requires a public declaration. If you do not declare it public, you must approach it indirectly through the function.


2022-09-20 08:42

If you have any answers or tips


© 2022 pinfo. All rights reserved.