Visual C++ .NET/Class/Overload — различия между версиями

Материал из .Net Framework эксперт
Перейти к: навигация, поиск
м (1 версия)
 
м (1 версия)
 
(нет различий)

Текущая версия на 12:05, 26 мая 2010

Overload Methods

 
#include "stdafx.h"
#include <typeinfo.h>
#using <mscorlib.dll>
using namespace System;
class MyMath {
public:
    double Add(double x, double y);
    int Add(int x, int y);
};
double MyMath::Add(double x, double y) {
    return x + y;
}
int MyMath::Add(int i, int j) {
    return i + j;
}
void main(void)
{
    MyMath inst;
    Console::WriteLine(inst.Add(10,20));
    Console::WriteLine(inst.Add(1.5,2.7));
}