Box Class Member Access C# with Example
using System; namespace CSharpClass { class Box { double width; double height; double length; private double Volume() { double volume; volume = length * height * width; return volume; } public void SetSize(double h, double l, double w) { height = h; width = w; length = l; } public void Display() { Console.WriteLine("Height: " + height); Console.WriteLine("Width: " + width); Console.WriteLine("Length: " + length); Console.WriteLine("Volume: " + Volume()); } } class UsingBoxClass { static void Main(String[] arg) { Box cpuCabinet = new Box(); cpuCabinet.SetSize(10, 20, 30); cpuCabinet.Display(); //cpuCabinet.Volume(); } } }