---
title: "Can we make a program having structure or class under structure?"  
description: "Can we make a program having structure or class under structure?"  
author: "Abhishek Srivasatava"  
published: 2016-09-17  
updated: 2020-09-23  
canonical: https://www.mindstick.com/interview/23044/can-we-make-a-program-having-structure-or-class-under-structure  
category: "c#"  
tags: ["c#", ".net", "class", "struct"]  
reading_time: 2 minutes  

---

# Can we make a program having structure or class under structure?

Yes, we can make a program having structure or class under structure.\

```
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks; namespace ConsoleApplication14{    struct demo    {             public
void fun1()        {            demo2
d2 = new demo2();            demo3
d3 = new demo3();                  
d2.fun2();           
Console.WriteLine("structure under structure is implemented
successfully");           
d3.fun2();           
Console.WriteLine("structure under class  is implemented successfully");        }        struct
demo2         {           
public void fun2()            {               
Console.WriteLine("Testing Comment");            }        }        class
demo3        {           
public void fun2()            {               
Console.WriteLine("Testing Comment");            }        }                   }    class Program
    {         static
void Main(string[] args)        {            demo
d1 = new demo();           
d1.fun1();            demo2
d2 = new demo2();            demo3
d3 = new demo3();            
d2.fun2();           
Console.WriteLine("Class under structure is implemented
successfully");           
d3.fun2();           
Console.WriteLine("Class under class is implemented
successfully");            
Console.ReadLine();                    }        struct
demo2        {           
public void fun2()            {               
Console.WriteLine("Testing Comment");            }        }        class
demo3        {           
public void fun2()            {               
Console.WriteLine("Testing Comment");            }        }            }}
```

## Answers

### Answer by Abhishek Srivasatava

Yes, we can make a program having structure or class under structure.\

```
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks; namespace ConsoleApplication14{    struct demo    {             public
void fun1()        {            demo2
d2 = new demo2();            demo3
d3 = new demo3();                  
d2.fun2();           
Console.WriteLine("structure under structure is implemented
successfully");           
d3.fun2();           
Console.WriteLine("structure under class  is implemented successfully");        }        struct
demo2         {           
public void fun2()            {               
Console.WriteLine("Testing Comment");            }        }        class
demo3        {           
public void fun2()            {               
Console.WriteLine("Testing Comment");            }        }                   }    class Program
    {         static
void Main(string[] args)        {            demo
d1 = new demo();           
d1.fun1();            demo2
d2 = new demo2();            demo3
d3 = new demo3();            
d2.fun2();           
Console.WriteLine("Class under structure is implemented
successfully");           
d3.fun2();           
Console.WriteLine("Class under class is implemented
successfully");            
Console.ReadLine();                    }        struct
demo2        {           
public void fun2()            {               
Console.WriteLine("Testing Comment");            }        }        class
demo3        {           
public void fun2()            {               
Console.WriteLine("Testing Comment");            }        }            }}
```


---

Original Source: https://www.mindstick.com/interview/23044/can-we-make-a-program-having-structure-or-class-under-structure

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
