can we make a class static without using static keyword?

Answer Posted / shadab alam

yes we can make a class static without using static keyword
We can prove it by following program.

we konw that static member of a class can be accessed by
using the class name now I will do it without static
keyword specify in sub class

Like a.abc.add()
where a is class name and abc is also class name but
without static keyword.But it executed successfully.
this proves that inner class is a static class.


using System;
static class a
{



public static void my()
{
Console.WriteLine("outer class's method");
}
class abc
{


public static void add()
{
Console.WriteLine("Inner class's
method");
}
}
public static void Main()
{

a.my();
a.abc.add();
}


}

Is This Answer Correct ?    6 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why is abstraction needed?

744


What is Difference Between Inheritance and creating object and getting data? means Class A extends B{ B.getMethod();} (OR) Class A{ b obj=new B(); obj.getMethod(); }

2192


Plese get me a perfect C++ program for railway/airway reservation with all details.

3642


What type of loop is a for loop?

848


What is stream in oop?

1026


What is multilevel inheritance in oop?

753


What is class and example?

798


What is the renewal class?

2398


What is polymorphism explain?

950


What are the benefits of interface?

780


What is the problem with multiple inheritance?

797


What is abstraction with example?

816


Will I be able to get a picture in D drive to the c++ program? If so, help me out?

1856


if i have same function with same number of argument but defined in different files. Now i am adding these two files in a third file and calling this function . which will get called and wht decide the precedence?

3090


What is the diamond problem in inheritance?

798