//How to write a program for namespace in visual c++
#include"StdAfx.h"
#include<iostream>
using namespace std;
namespace uptu
{
class abes
{
private:
int x;
public:
void assign() {
x=100;
}
void show() {
cout<<x;
}
};
class akeg
{
private:
int x;
public:
void assign() {
x=121;
}
void show() {
cout<<x;
}
};
}
int main()
return 0;
}
namespace india
{
namespace uptu
{
public class abes
{
public void show()
{
Console.WriteLine("This is alias");
}
public static void Main()
{
y.abes a=new y.abes();
a.show();
}
}
}
}
#include"StdAfx.h"
#include<iostream>
using namespace std;
namespace uptu
{
class abes
{
private:
int x;
public:
void assign() {
x=100;
}
void show() {
cout<<x;
}
};
class akeg
{
private:
int x;
public:
void assign() {
x=121;
}
void show() {
cout<<x;
}
};
}
int main()
{
uptu::abes a;
a.assign();
uptu::akeg b;
b.assign();
b.show();
uptu::abes a;
a.assign();
uptu::akeg b;
b.assign();
b.show();
return 0;
}
___________________________________________________________________
// namespace in csharp
// must be added at beginning
using System;
using y=india.uptu;
// must be added at beginning
using System;
using y=india.uptu;
namespace india
{
namespace uptu
{
public class abes
{
public void show()
{
Console.WriteLine("This is alias");
}
public static void Main()
{
y.abes a=new y.abes();
a.show();
}
}
}
}
No comments:
Post a Comment