C++ Programming - OOPS Concepts - Discussion
Discussion Forum : OOPS Concepts - General Questions (Q.No. 19)
19.
Which of the following approach is adapted by C++?
Discussion:
27 comments Page 1 of 3.
AMIT KKUKADIYA said:
1 decade ago
In a bottom-up approach the individual base elements of the system are first specified in great detail. These elements are then linked together to form larger subsystems, which then in turn are linked, sometimes in many levels, until a complete top-level system is formed. This strategy often resembles a "seed" model, whereby the beginnings are small, but eventually grow in complexity and completeness. However, "organic strategies", may result in a tangle of elements and subsystems, developed in isolation, and subject to local optimization as opposed to meeting a global purpose.
Object-oriented programming (OOP) is a programming paradigm that uses "objects" to design applications and computer programs. It utilizes several techniques from previously established paradigms, including inheritance, modularity, polymorphism, and encapsulation. Even though it originated in the 1960s, OOP was not commonly used in mainstream software application development until the 1990s. Today, many popular programming languages support OOP.
Object-oriented programming's roots reach all the way back to the 1960s, when the nascent field of software engineering had begun to discuss the idea of a software crisis. As hardware and software became increasingly complex, how could software quality be maintained? Object-oriented programming addresses this problem by strongly emphasizing modularity in software.
Object-oriented programming (OOP) is a programming paradigm that uses "objects" to design applications and computer programs. It utilizes several techniques from previously established paradigms, including inheritance, modularity, polymorphism, and encapsulation. Even though it originated in the 1960s, OOP was not commonly used in mainstream software application development until the 1990s. Today, many popular programming languages support OOP.
Object-oriented programming's roots reach all the way back to the 1960s, when the nascent field of software engineering had begun to discuss the idea of a software crisis. As hardware and software became increasingly complex, how could software quality be maintained? Object-oriented programming addresses this problem by strongly emphasizing modularity in software.
Danh Hoang said:
4 years ago
Structure/procedure-oriented programming languages like C programming language follow top-down approach. Whereas object-oriented programming languages like C++ and Java programming language follow a bottom-up approach.
The top-down approach begins with high-level design and ends with a low-level design or development. Whereas, the bottom-up approach begins with low-level design or development and ends with high-level design.
In the top-down approach, the main() function is written first and all sub-functions are called from the main function. Then, sub-functions are written based on the requirement. Whereas, in a bottom-up approach, code is developed for modules and then these modules are integrated with the main() function.
Nowadays, both approaches are combined together and followed in modern software design.
The top-down approach begins with high-level design and ends with a low-level design or development. Whereas, the bottom-up approach begins with low-level design or development and ends with high-level design.
In the top-down approach, the main() function is written first and all sub-functions are called from the main function. Then, sub-functions are written based on the requirement. Whereas, in a bottom-up approach, code is developed for modules and then these modules are integrated with the main() function.
Nowadays, both approaches are combined together and followed in modern software design.
(9)
Gelu Menumorut said:
9 years ago
"Approach" is a too general word, like "do", you cannot ask a question "How C++ is doing?", and provide options like top-down, bottom-up, etc.
It's just another inaccurate (by a missing essential detail), in which the word "parsing" or "compiling" should have cleared it much more. People actually answered very specific questions like "what means bottom-up parsing/compiling?" and not the question from the quiz, and probably all gave the impression that they understood the question and answered it well, but that means also that they answered it wrong: if the question is "How is C++ doing?", And you answered "bottom-up", than your answer is wrong, the right answer is "C++ is doing pretty well so far, but nobody knows what's in store for it", and this option was not provided.
It's just another inaccurate (by a missing essential detail), in which the word "parsing" or "compiling" should have cleared it much more. People actually answered very specific questions like "what means bottom-up parsing/compiling?" and not the question from the quiz, and probably all gave the impression that they understood the question and answered it well, but that means also that they answered it wrong: if the question is "How is C++ doing?", And you answered "bottom-up", than your answer is wrong, the right answer is "C++ is doing pretty well so far, but nobody knows what's in store for it", and this option was not provided.
U.B.Somasekar said:
1 decade ago
Actually in C++ the execution as usually starts from main fun but one thing to observe here is the object gets created first inside the main fun which is of class type and class is always present above (top of) the main fun containing members and member fun's.
So during the time of compilation, the objects of main get created that contains separate copies of data members present in the class which is top of main and memory fun's gets shared to all object.
So first the object gets created at bottom and uses the encapsulated data memory's or memory fun's presented inside the class at top.
So during the time of compilation, the objects of main get created that contains separate copies of data members present in the class which is top of main and memory fun's gets shared to all object.
So first the object gets created at bottom and uses the encapsulated data memory's or memory fun's presented inside the class at top.
Sakshi said:
1 decade ago
C follows top down approach while C++ follows bottom up approach.
In Top Down Approach, first we write the main function, that calls stubs, then subdivide these stubs in smaller stubs until a real work has to be done, that code in the final files.
In Bottom Up approach, Firstly gathering of small components that do basic actions that are required to do the full program work. Then assemble them by custom code, then assemble these parts to write the main method.
In Top Down Approach, first we write the main function, that calls stubs, then subdivide these stubs in smaller stubs until a real work has to be done, that code in the final files.
In Bottom Up approach, Firstly gathering of small components that do basic actions that are required to do the full program work. Then assemble them by custom code, then assemble these parts to write the main method.
Rajeev dwivedi said:
1 decade ago
Actually c is called top-down approach because in c you need to define main function then define functions. It will work. And if you define functions first then define main function, still it will work. But in oop if you define main function first then class. It will not work. Whenever we define in oop, define class then go to main function. So it is called bottom-up approach because we define main function down and go to down to up.
Sourav Pathak said:
10 years ago
Guys, there is nothing related with main function. Some say that since in c++ program starts executing from main function, so C++ is a bottom up approach.
I was asked the same question in TCS interview and I had also replied the same. The result was that, they slammed me. So go on basics.
I was asked the same question in TCS interview and I had also replied the same. The result was that, they slammed me. So go on basics.
Balaji Ponmuthu said:
1 decade ago
For C:
In Top Down approach main function should be at the top, ie other function definition are after main.
{..
main()
{...
..}
{ initialization,
Func()
}
For C++:
In bottom up approach we can define main anywhere in our program.
{
Initialization;
Fun()
{
}
}
main(){
..}
In Top Down approach main function should be at the top, ie other function definition are after main.
{..
main()
{...
..}
{ initialization,
Func()
}
For C++:
In bottom up approach we can define main anywhere in our program.
{
Initialization;
Fun()
{
}
}
main(){
..}
Mkoter said:
6 years ago
Usually, in C language, the functions are given priority than the data types. First, the main functionality of the program is discussed and then the subroutines to modularize the code into smaller parts are decided.
Hence it's called the top-down approach.
Hence it's called the top-down approach.
Raj Kumar Sepat said:
8 years ago
Let's take the example of the main function in C++ if we are defining a class or other functions before the main function, the execution of the program always begin with Main Function, so with this prospective, we can say C++ is a Bottom-up approach.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers