Difficult Code ??!!
- From: "HELLO $$$" <fares@xxxxxxxxxxxxxxxx>
- Date: Mon, 23 Oct 2006 11:23:50 +1000
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.
============================================
.
- Prev by Date: Commandline Add/Remove Program
- Next by Date: Re: V.studio
- Previous by thread: Commandline Add/Remove Program
- Next by thread: Default Text value for Custom Control
- Index(es):
Relevant Pages
|