2 C# Class's Questions

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)
 
D

deepak

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;
}
}
 
D

deepak

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)
 
D

deepak

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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top