Is C++ a real OOP language??

First of all, my deepest apologies for my absense for almost a month, but then i had my semester exams going on.. i could'nt help it... so i thought i should think of some exciting topic to get back into bussiness... so i think this one will interest you...
Okay, okay, for all those who are scratching their heads thinking about, what the hell is this all about...i won't keep you waiting i go
First let me give you the definition of an OBJECT ORIENTED PROGRAMMING LANGUAGE, any language which is coded invariably in classes is a OOP language..still not clear.. that is the whole source should come under some class or other, yes.. no stray global functions global variables outside classes... yes in OOPs classes rule!! So by the above concept is C++ an OOP?? think again! it is never a OOP, you have atleast one function not controlled by classes.. main()?.. yes , you got it holmes... so it can never be coded in a OOP way, and mostly every expert programmer, even Bjarne Stroustrup( sorry if i got the spelling wrong!!) will have atleast a few non-class functions and variables...

So What is C++ afterall??

Good question!! even i often wondered about this... until somewhere i found the correct definition for C++ , it comes between Object Oriented and Object Based Languages.
That is , it uses objects and classes... but not completely dependent on objects.. remember that you can code a C program and compile it as a C++ file...

Gimme an example of OOP!!

Sure.. Java,C# are the most commonly used OOPs, Java is the most widely used OOP in the world, and for java illiterates out there, each java program is contained in a class with the name of the program... and Visual Basic is an example of another object based language.

Rumour: ANSI is taking efforts to make C++ an OOP!! Smells tasty?? maybe someday we'll have main() put inside some class... but surely not in the near future...

Coming soon..,
Review on the much raved open source browser from Mozilla... Firefox

pl mail me and let me know how my articles are.. i love feedbacks... and give me suggestions about how to improve my articles..


Namespaces in C++

Namespaces..uhh?sounds like all alien stuff?? even for seasoned C++ players? let me explain...Now we all study in classes that C++ is an "OBJECT ORIENTED LANGUAGE", but actually strictly speaking C++ does not come under the category of OOP, but it is actually an OBJECT BASED LANGUAGE. Think again, do you always start a C++ program from inside a class? naa!! That is why. An OOP language should have everything in the form of objects , that is classes are mandatory, like in Java program. But hey, then we can do C++ programs exactly like a C++ program exactly like a C program, in the structered approachthat is why C++ is not exactly an OOP language.SO what's the big Deal??Now this OOP issue was haunting the ANSI(American National Standards Institute), who are the cheif players in C++. So they came up with the idea of NAMESPACES in around 1997. Now ,some other languages support it. Whole namespace bussiness is about keeping the global part of the program from getting polluted. Now if we have too many global variables in one or many files,(read header files), it will create many problems of duplicate declaration(or redefintions). To avoid this , they introduced a new level caled namespace. Now, anyhing declared global come under the global namespace. We can explicitly declare our programs inside a separate namespace, so that we can use same variable names or identifiers used in stadard headers,(yes can have a variable called cout). Now, ANSI has patched all the standard headers and reincorporated them into the namspace called the std namespace.But this is just come into existance and not extensively used , even now. But most new compilers support this technique. To maintain compatability with the old mode of programming, the following changes have been brought in. The headers with namespace does not have the conventional *.h but , sans any extension, ie becomes . The choice is yours whether to include the namespace version or the conventional headers.But Dude, how do i exactly use namespace?Okay, into technical details of using namespaces




//body //do anything!!,variables ,function,classes etc


I am not going into C++ details of using the namespaces in this episode, actually , i had that in mind , but the blogspot's html editor, thinks #include's tags and cout's insertion operators as html tags and creates errors, so i'll get back into that some time later..

In Closing...

Okay ,some may have convinced that namespaces are great, but then, is it not another face of classes itself!! Maybe not, definitely, namespaces avoid the global pollution. And you can use the standard names, they are not ANSI's private property anymore!! But , obviously it will take time before the namespaces are extensively used. Ahh, maybe this blog may speed that up!!



I m narayan, a comp. sc engg student, i ve been programmin since i was 12 years old... i wld like to share and also get new programming tips,techniques, news etc...
u can get me over