In all of the classes we have defined so far, we were using a single file to implement the class. In C#, you can create a class (the same class) in different files. This means that you can start a class in one file and continue it in another file or in other files. This is referred to as partial implementation.
If you have programmed in C++ or C++/CLI, don't confuse its header and source files with C#'s partial implementation of classes. In C++ or C++/CLI, you can include the structure of a class with its member variables (called fields in C#) and the declaration of its methods. In C++, a header file has the extension .h. Here is an example of a C++/CLI header file:
Header File: Cylinder.h
#pragma once
using namespace System;
public ref class CCylinder
{
private:
double rad;
double hgt;
public:
CCylinder(void);
CCylinder(double radius, double height);
property double Radius
{
double get() { return rad; }
void set(double value) { rad = value; }
}
property double Height
{
double get() { return hgt; }
void set(double value) { hgt = value; }
}
double Volume();
};
NaveenKumar
Er.deepakdalal, if this helps please login to Mark As Answer. | Alert Moderator