2 C# Class's Questions

  • Thread starter Thread starter deepak
  • Start date Start date
D

deepak

Hi,

There are 2 Questions on C# Classes :->

Quest 1. What will be result of below program.
Class A {
A()
{
B objB = new B();
}
}
class B {
B()
{
A objA = new A();
}
}

}
static void Main(string[] args)
{

A objA = new A();
B objB = new B();



Quest 2. How can I call method written in Class B without creating instance
of
Class B i.e. without using B objB= new B();

Class A{ Class B: A{ Class C: B{
Class D:C{
public Calc() public Calc() public Calc()
public Calc()
{ { {
{
//// //// ////
////
return 1; return 2; return 3;
return 4;
} } }
}
} } }
}


- Deepak
(e-mail address removed)
 
Actually Question 2 is not showed correctly which I am writing again to make
it clear

Class A{

public Calc()
{
////
return 1;
}
}

Class B: A{

public Calc()
{
////
return 2;
}
}

Class C: B{

public Calc()
{
////
return 3;
}
}

Class D: C{

public Calc()
{
////
return 4;
}
}
 
Can anybody reply to my 2nd question....Is this possible throuhg delegates..I
am waiting for your replies ASAP.

deepak said:
Actually Question 2 is not showed correctly which I am writing again to make
it clear

Class A{

public Calc()
{
////
return 1;
}
}

Class B: A{

public Calc()
{
////
return 2;
}
}

Class C: B{

public Calc()
{
////
return 3;
}
}

Class D: C{

public Calc()
{
////
return 4;
}
}



deepak said:
Hi,

There are 2 Questions on C# Classes :->

Quest 1. What will be result of below program.
Class A {
A()
{
B objB = new B();
}
}
class B {
B()
{
A objA = new A();
}
}

}
static void Main(string[] args)
{

A objA = new A();
B objB = new B();



Quest 2. How can I call method written in Class B without creating instance
of
Class B i.e. without using B objB= new B();

Class A{ Class B: A{ Class C: B{
Class D:C{
public Calc() public Calc() public Calc()
public Calc()
{ { {
{
//// //// ////
////
return 1; return 2; return 3;
return 4;
} } }
}
} } }
}


- Deepak
(e-mail address removed)
 
Can anybody reply to my 2nd question... Is this possible through
delegtes?...i am waiting for your answers....

deepak said:
Actually Question 2 is not showed correctly which I am writing again to make
it clear

Class A{

public Calc()
{
////
return 1;
}
}

Class B: A{

public Calc()
{
////
return 2;
}
}

Class C: B{

public Calc()
{
////
return 3;
}
}

Class D: C{

public Calc()
{
////
return 4;
}
}



deepak said:
Hi,

There are 2 Questions on C# Classes :->

Quest 1. What will be result of below program.
Class A {
A()
{
B objB = new B();
}
}
class B {
B()
{
A objA = new A();
}
}

}
static void Main(string[] args)
{

A objA = new A();
B objB = new B();



Quest 2. How can I call method written in Class B without creating instance
of
Class B i.e. without using B objB= new B();

Class A{ Class B: A{ Class C: B{
Class D:C{
public Calc() public Calc() public Calc()
public Calc()
{ { {
{
//// //// ////
////
return 1; return 2; return 3;
return 4;
} } }
}
} } }
}


- Deepak
(e-mail address removed)
 
Back
Top