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

What is encapsulation in oop?

601


What is abstraction oop?

622


What is the real time example of inheritance?

637


Which method cannot be overridden?

575


Write a program to implement OOPS concepts such as inheritance, polymorphism, friend function, operator overloading?

4235






What is meant by oops concept?

608


can inline function declare in private part of class?

3655


What is abstraction in oop?

631


What is a null tree?

627


What is oops and why we use oops?

569


How many human genes are polymorphic?

570


write string class as your own class in java without using any built-in function

1976


What do you mean by Encapsulation?

640


What is basic concept of oop?

696


Question: Implement a base class Appointment and derived classes Onetime, Daily, Weekly, and Monthly. An appointment has a description (for example, “see the dentist”) and a date and time. Write a virtual function occurs_on(int year, int month, int day) that checks whether the appointment occurs on that date. For example, for a monthly appointment, you must check whether the day of the month matches. Then fill a vector of Appointment* with a mixture of appointments. Have the user enter a date and print out all appointments that happen on that date.

628