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

Asked 2 years ago, Updated 2 years ago, 42 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


© 2024 OneMinuteCode. All rights reserved.