Hi,

I need the drawbacks of procedural programming language with good program to explain

if any body know best example please send it.

I also need the best examples to describe object and class.


Please its urgent


regards,
Samba

Member Avatar for iamthwee

How about google or even your notes?

bool senseOfUrgency = false;

Do you want an example to explain classes in English, or in C++? Or perhaps both? Is there something specific about classes you don't understand?

Do you want an example to explain classes in English, or in C++? Or perhaps both? Is there something specific about classes you don't understand?

Hi,
thanks for ur replay
I need to explain classes in english and C++


I want the difference between procedural programming language and opps languages with beautiful example


regards,

Hi,
thanks for ur replay
I need to explain classes in english and C++


I want the difference between procedural programming language and opps languages with beautiful example


regards,

Oh so you mean mid-level commands vs high level commands?

"Procedural programming
A programming methodology involving a linear, 'shopping list' approach to programming. This contrasts with the more abstracted approach of 'Object Oriented Programming'"

It sounds to me like your instructor wants a difference between OOP and procedural programing.

This isn't too hard.

Think of a situation where you have to do something easy like, oh say a sort.

Create a god-method that does the entire sort for you. Put it in its own namespace if you want.

Now create a class called GenericSort that has virtual methods Swapper and DetermineSort.

Make the class GenericSort - the method DetermineSort (to determine when a sort is done) will be virtual and the method Swapper (to determine if one object is less than the other or vice versa)) will obviously .

Extend from class Swapper and class GenericSort and create your own, user define Sort subclass.

Extend from class GenericSort but this time you will create an AdapterSort class that will encapsulate the same data from your procedural programming example and performs the sort by overriding the definition of the methods DetermineSort and GenericSort to accomodate for your god method (this may be hard, but it is doable).

Afterwards make an example of where a user has to access either GenericSort 1 or 2 and accesses the same methods to do both sorts, even though they're most likely done in different ways. Then of course create an instance of GenericSort and an instance of AdapterSort and set the reference of the GenericSort the user has access to, to the first one then second and make the user perform both sorts - obviously the user will be able to perform them the same way despite their differences.

Explain to your Instructor that the OOP version (that demonstrates inheritance and polymorphism) is stronger because you can encapsulate data from the user (hide how you do things and still keep the functionality of the things you're hiding), add polymorphic behavior and allow class-reuseability for different kinds of classes that have no real connection to the client-class ( the individual that needs to make a command but has no knowledge of the REAL command being made - Adaptation ).

Whoops I guess I forgot the key method "sort" that takes an array.pointer of the type to be sorted.

Hopefully you'll get the idea =)

Hi,
I want the difference between procedural programming language and opps languages with beautiful example
,

I think you are confusing terms -- oops is not the opposite of a procedural language. An "event driven" language is the opposite of procedural.

procedural: the program executed from top down with loops to redirect it. Most console programs are procedural programs.

event driven: The program executes a piece of code when some event happens, such as when you type on a keyboard, click a button, or select a menu. All MS-Windows GUI programs are event driven programs.

I think you are confusing terms -- oops is not the opposite of a procedural language. An "event driven" language is the opposite of procedural.

procedural: the program executed from top down with loops to redirect it. Most console programs are procedural programs.

event driven: The program executes a piece of code when some event happens, such as when you type on a keyboard, click a button, or select a menu. All MS-Windows GUI programs are event driven programs.

Event driven programs are also loop-based, right? I.e., you enter a loop that continually checks if events are occurring, and does something based on those events, and that loop goes on for the duration of the program (excluding start-up and shut-down stuff when the user begins or ends the program).

Also, C++ can create both of these types of programs, right? So would we say its event-driven since it can support that type of program, or do we say it's both? Or neither?

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.