i have one question...what is actually meant by object oriented...how do u know whether the programming is an object oriented or not...like people always say that C++ is an object oriented and VB is not really an object oriented..can somebody explain this..here

Recommended Answers

All 7 Replies

>what is actually meant by object oriented
Put simply, the problem is solved by thinking with objects. Then you ask what an object is and we say that it's a self-contained unit of data and code that operates on that data such that a single problem can be addressed using the object. As an example, rather than creating a socket variable and calling functions with it, you create a socket object and call methods provided by the socket class.

>people always say that C++ is an object oriented and VB is not really an object oriented
C++ is multi-paradigm. It directly supports the features necessary for several different methodologies, including object-oriented. VB is probably more object-oriented that you would expect because of the form editor, and VB.NET is leaning heavily in the direction of OO.

i don't really understand by what u mean...can some one make it clearer..

Hmm big subject, there are whole books written purely to address this one question. Find one on Amazon or InformIT.com and read it, it will be worth every penny if your interested/studying or working computer programming.

Of the ones I've read these were some of the best :

Object Thinking, by David West Publisher: Microsoft Press Pub Date: February 11, 2004 ISBN: 0-7356-1965-4,

Sams Teach Yourself C++ in 24 Hours, Third Edition by Jesse Liberty Publisher: Sams Pub Date: August 24, 2001 ISBN: 0-672-32224-2

Pragmatic Programmer, The: From Journeyman to Master by Andrew Hunt, David Thomas Publisher: Addison Wesley Professional Pub Date: October 20, 1999 ISBN: 0-201-61622-X

Most languages since the late 90's support OO concepts to various degrees of depth and with various degrees of success. There is hot debate over what TRUE OO Programming is. To describe OO is beyond the scope of a topic in a forum, and to appreciate what the OO fuss is all about you need to know a bit about the history of computers and the programming of them.

At its most basic it is a method to design and implement computer software, that makes parts of it re-usable in many different software solutions, to make software easier to maintain and extend in the future.

Consider this logging errors in your program. There are many ways to do that and a psuedo program might be

string theError = "An error ocured";
File = OpenFile("c:\somefile");
writefile(file, theError);

Now everytime you start a new programming project if you want to implement some form of logging, you have to write similar statements again and again and again....zzzzzzzzzzzzz

so instead, you hide all this implementation in a class called ...I don't know ErrorLog

class ErrorLog
        File m_Logfile;

        static void LogError(string theError){writefile(m_LogFile, theError)};

I compile this as a self contained library (a type of program) and whenever I need logging in a futur programming solution I just remember to include a reference to my class library with my ErrorLog class in it and use it for logging. And to log an error I just call :

ErrorLog.LogError("my error");

I don't care how ErrorLog does it, the public function in the errorlog class tells me "Give me a string and I'll log it as an error"
In the futire I might extend the class and make it do funky things like send errors as emails to administrative staff or a database. It's all hidden within the class so all my previous programs still work as before, or I make a new class that "inherits" from ErrorLog so I get all the functionality of ErrorLog (without having to write all that agin) and just add the new stuff.

Anyway I digress, I could go on for hours.

1. It is a way of thinking, especially organizationally. Different tasks are the responsibilities of different objects. For example, in C++, it's the responsibility of the vector to reallocate its own memory as needed, not some that of some procedure that uses the vector.

2. It's a way to create a dynamic typing system. This means I can have and use a Shape object and have it be an Ellipse, a Rectangle, or generalised Polygon without knowing what's underneath. Relative to C, this is C++'s biggest advantage.

3. It's a way of shortening code size and treating data consistently. Instead of needing to se different names, as in vector_get(v,i) and string_get(s,i) and map_get(m,i), you can write v.get(i) and s.get(i) and m.get(i). (Or, depending on the programming language and library, v, s, and m.)

It's not really about hiding implementation, since you can do that in any language with subroutines.

when is a programming language is considered as object oriented language?

That depends on who's doing the considering. Many languages have constructs that make it easy do object oriented programming, that wouldn't necessarily be considered object oriented languages.

when is a programming language is considered as object oriented language?

When it supports Encapsulation (that's classes basically) AND inheritance (single or multiple) AND polymorphism (which relies on the previous two and is wide ranging in scope)

VB6 for example supports classes, it doesn't properly support inheritance though, and without the first two polymorphism is out. So VB6 is not 100% OO but there is some OO in there.

C++ is both an OO language AND not an OO language C++ supports all three pillars of OO, BUT it doesn't force you to use them you can still create structured programs in C++ without using any of it's OO capability.

JAVA is an OO language everything is an object, even the main starting point of the program is a class, you cannot (to the best of my knowlwedge) write a JAVA program without classes.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.