Difficult Code ??!!



Please read this ( C++ .NET ) Code:
This is the main project file for VC++ application project
// generated using an Application Wizard.

#include "stdafx.h"

#using <mscorlib.dll>

using namespace System;

__gc class Animal

{

public:

int legs;

void SetName(String *name)

{ strName = strName->Copy(name); }

String* GetName() { return strName; }

private:

String *strName;

};

int _tmain()

{

Animal *cat, *dog;

cat = new Animal;

dog = new Animal;

cat->SetName("Cat");

cat->legs = 4;

dog->SetName("Dog");

dog->legs = 4;

Console::WriteLine("Animal 1");

Console::Write("Name: ");

Console::WriteLine(cat->GetName());

Console::Write("Legs: ");

Console::WriteLine(cat->legs);

Console::WriteLine();

Console::WriteLine("Animal 2");

Console::Write("Name: ");

Console::WriteLine(dog->GetName());

Console::Write("Legs: ");

Console::WriteLine(dog->legs);

Console::WriteLine();

return 0;

}

The "stdafx.h" file contains: #include <iostream> & #include <tchar.h>

++++++++++++++++++++++++++++++++++++++++++++

This code contains some old data. My "Visual Studio 2005 " progam could't
build it except after conversion into the old version.But I don't want this
because I want to know what is updated.

Now I want to let the compile accept it and compile it without conversion
to old version - How ? by doing some modifications. I did the following
changes as :

I deleted _gc , and _tmain and replaced the latter by" int main"

I found the errors decreased much except one only which tells to add "clr ".

Please can any person make successful changes in this code to be built good
without convesion? and tell me what's new project template he chose (
console. CLR\ empty CLR ....etc

Thank all.

============================================


.



Relevant Pages

  • Re: WG: SI Units - has Ada missed the boat?
    ... I don't remember the details but there was also a way to define the conversion from various units into the generic _UNITS. ... This program would then write the ADA specs and bodies for the conversion. ... The "UNITS" package took about 4 hours to compile and every component took a long time to compile because every expression had to be compared to the myriad of overloads to determine if the expression was valid. ... myint: INTEGER; ...
    (comp.lang.ada)
  • Re: Microsoft Losing Interest in C#?
    ... > The code doesn't compile right now because, IIRC, the JCLA generated a few ... > javaisms in the sections where a direct conversion wasn't possible. ... The JLCA doesn't understand the Comparable interface, ... UUID.cs: error CS0246: The type or namespace name 'MessageFormat' ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: [ANNOUNCE] high-res-timers patches for 2.6.6
    ... but all are compile in. ... >>I would have to redo the conversion code. ... can, at boot time, switch to one of the standard clocks and thus disable HRT (or ... I had not considered not using the APIC timer if it was available. ...
    (Linux-Kernel)
  • 50 years of progress in the language
    ... almost every program would compile and run correctly using ... Smaller length alphabetic test onstant strings were treated as ... Conversion between integer variabless and equivalent digit strings ... the character array and the character string. ...
    (comp.lang.fortran)
  • Re: fast and accurate in mixed mode operations
    ... < double using the command dble() in the expressions or would it be ... For the same conversion, the speed and accuracy should be ... precision, then you might need a conversion function. ... There used to be questions about constant conversion at compile ...
    (comp.lang.fortran)