Click here to Skip to main content
15,902,938 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
Can anyone explain belo coding:


C#
using System;

class MyClass
{
  public int[] MyIntArray;
  public int Y;
  public int ObjectCount = 0;

  public MyClass()
  {
    MyIntArray = new int[10];
    //Do work necessary during object creation
  }
  //Overloads the MyClass allowing you to initialize Y
  public MyClass(int myY)
  {
    Y = myY;
  }
}

class MainClass{
  static void Main(string[] args)
  {
    MyClass X = new MyClass();

    X.ObjectCount++;

    MyClass YY = new MyClass(10);
  }

}
Posted
Updated 29-Nov-11 21:16pm
v2

1 solution

Do you have any idea how much work explaining code line by line is?
Every single line needs a paragraph of explanation! For example:
int next = r.Next();

Create a new variable called "next" which can hold a integer value. From the previously declared Random instance "r", call the "Next" method to get a new random number, and assign it to the "next" variable.

Can you imagine how long it would take us to explain even a very short code fragment like your example, line by line?

No. It is not going to happen. If you have a specific problem, then ask a question about it. But think first - would you want to sit down for 45 minutes and type up a line-by-line description for no good reason?
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900