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
How oops is better than procedural?
Is abstract thinking intelligence?
any one please tell me the purpose of operator overloading
What is pointer in oop?
What is class in oop with example?
Why oops is important?
What is advantage of inheritance?
write a program using c++ to implement single contiguous memory mangement techniques.display the content of the main memory after yhe allocation of jobs and percentage of the wastage of the main memory
What is inheritance write a program to show use of inheritance?
Why is destructor used?
What is polymorphism and its types?
What are oops methods?
What is new keyword in oops?
Why can't we have instance(stack) of a class as a member of the same class like eg.Class A{A obj;} as we can have self refential pointer
What are the benefits of oop?