Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Old 03-29-2005, 06:30 PM   #1 (permalink)
357mag
Registered User
 
Join Date: Mar 2005
Posts: 15
357mag is on a distinguished road
A question about Visual C++.Net

As I stated in my other post Borland C++ Builder places some default code in the editor window when you start a new console project. I was wondering if Microsoft's Visual C++.NET does the same thing, place a few lines of default code in the editor window? If it does does it explain what it is in the help files?

Another question I have is I noticed on one site about how to write a console program with Visual C++.NET it said this in the code window:

std:: cout << "Hello World" << std::endl;

Now this std:: I've never seen before as it's not mentioned in C++ books. Is this something peculiar to Visual C++.NET? Why is it there? Does the help files talk about it?
357mag is offline   Reply With Quote
Old 03-30-2005, 05:01 AM   #2 (permalink)
DJMaze
Senior Contributor
 
DJMaze's Avatar
 
Join Date: Mar 2005
Posts: 673
DJMaze is on a distinguished road
std:: is used all over the place and is mostly not even needed to use
std is a "namespace" which contains functions inside it like cout and endl;
PHP Code:
int main( )
{
   
using namespace std;
   
cout << "Hello World" << endl;
   return 
0;

vs
PHP Code:
int main( )
{
   
std::cout << "Hello World" << std::endl;
   return 
0;

The BCB help write:
Most nontrivial applications consist of more than one source file. The files can be authored and maintained by more than one developer. Eventually, the separate files are organized and linked to produce the final application. Traditionally, the file organization requires that all names that aren't encapsulated within a defined namespace (such as function or class body, or translation unit) must share the same global namespace. Therefore, multiple definitions of names discovered while linking separate modules require some way to distinguish each name. The solution to the problem of name clashes in the global scope is provided by the C++ namespace mechanism.

The namespace mechanism allows an application to be partitioned into a number of subsystems. Each subsystem can define and operate within its own scope. Each developer is free to introduce whatever identifiers are convenient within a subsystem without worrying about whether such identifiers are being used by someone else. The subsystem scope is known throughout the application by a unique identifier.

It only takes two steps to use C++ namespaces. The first is to uniquely identify a namespace with the keyword namespace. The second is to access the elements of an identified namespace by applying the using keyword.
DJMaze is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
.NET Reflector question? verdell32 MS Technologies ( ASP, VB, C#, .NET ) 1 03-02-2006 05:15 AM
getting C# projects to run on Visual Studio .NET 2003 Apodysophilia MS Technologies ( ASP, VB, C#, .NET ) 3 02-21-2005 08:24 PM
c simple question problem with switch case if13121 Standard C, C++ 1 10-24-2004 09:43 PM


All times are GMT -8. The time now is 03:10 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting