Resources » Code Snippets » C# Syntax

Wrapper class example

Updated: Category: C# Syntax
Author: Member Level: SilverPoints: 5

Description :

This code shows example of wrapper class

/// Example for Wrapper class

public class Wrapper
private int x = 10;
private int y = 20;

public Wrapper()
// TODO: Add constructor logic here

public int add(int x, int y)
Wrapper.inside obj = new inside();
//core functionality of this method is written in the wrapped class.
int sum = obj.add(x, y);
return sum;

/// this class is wrapped by the wrapper class.
/// we can access only inside this class.
/// outside the class, we cant access this class.

private class inside

public int add(int x, int y)

return x + y;

Did you like this resource? Share it with your friends and show your love!

Responses to "Wrapper class example"
Guest Author: Rahul Ranjan   15 Apr 2012
Nice article...Only Example that is understandable for Wrapper class...!!

Guest Author: priya   12 Jun 2012
Gud article.easy to understand ...


Post Comment:

  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:   Sign In to fill automatically.
    Email: (Will not be published, but required to validate comment)

    Type the numbers and letters shown on the left.

    Submit Article     Return to Article Index
    Subscribe to Subscribers
    Active Members
    TodayLast 7 Daysmore...

    Awards & Gifts
    Talk to Webmaster Tony John
    Copyright © SpiderWorks Technologies Pvt Ltd., Kochi, India