Discussion :: OOPS Concepts - General Questions (Q.No.19)
Which of the following approach is adapted by C++?
Answer: Option B
No answer description available for this question.
|Ratnesh said: (May 25, 2012)|
|Because main function define after define of class but compiling process start from main function. Invoking object call function from classes.|
|Prashant said: (Jun 19, 2012)|
|If we use functional approach it is top down, and when we follow object oriented approach then it is bottom up approach.
So C always uses top down approach, whereas C++ also uses bottom up approach.
|Durgadevi said: (Jun 29, 2012)|
|Because we use main function in c++ at anywhere but the compiler starts to compile the program in main function so it is called as bottom up approach.|
|Rock said: (Jul 3, 2012)|
|Can some tell clearly what TOP DOWN, BOTTOM UP means ?|
|Harshita said: (Jul 3, 2012)|
|In Top Down approach main function should be at the top, ie other function definetion are after main, while in bottom up approach we can define main ayewhere in our program.|
|Shivendra said: (Jul 16, 2012)|
|Can some one clearly elaborate these two words that is top down and bottom up approach.|
|Chaitra said: (Sep 7, 2012)|
|Can anyone give example (i. E program) for both top-down and bottom-up approaches?|
|Amit Kkukadiya said: (Sep 8, 2012)|
|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.
|Rajeev Dwivedi said: (Dec 13, 2012)|
|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.|
|Archana said: (Apr 22, 2013)|
|If the main function is defined first in c++ then what action will takes place?|
|Spjsp said: (May 4, 2013)|
|As OOP operates on classes so, if we declare main before it then there will be an error like main() has an object whose associated class is not declared.|
|Sakshi said: (Jun 28, 2013)|
|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.
|Veerendra said: (Mar 25, 2014)|
|Why can't we write main function at the top?|
|Shrondi said: (Jun 29, 2014)|
|Can anyone explain properly. Thats how its work in C++ and C?|
|U.B.Somasekar said: (Nov 15, 2014)|
|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.
|Balaji Ponmuthu said: (Dec 24, 2014)|
In Top Down approach main function should be at the top, ie other function definition are after main.
In bottom up approach we can define main anywhere in our program.
|Ashik said: (Jan 30, 2015)|
|It just follows the bottom-up approach. Not compulsory that it may go bottom-up any time.|
|U.B.Somasekar said: (Feb 16, 2015)|
|Always the class should under the global region. i.e.above main.|
|Saurabh said: (Sep 10, 2015)|
|So, java and c# both follow bottom up approach, right?|
|Sourav Pathak said: (Oct 21, 2015)|
|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.
|Alakya said: (Jan 30, 2016)|
|Usually in C language, the functions are given priority then 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 top down approach.|
|Gelu Menumorut said: (Aug 11, 2016)|
|"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.
|Sathish said: (Sep 3, 2016)|
|The declaration has placed after the function made to be called then the main function compiles to be. These were the difference between the c programming and the c++ programming.|
|Raj Kumar Sepat said: (Apr 11, 2017)|
|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.|
|Mkoter said: (Jun 18, 2019)|
|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.
|Danh Hoang said: (Jun 13, 2021)|
|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.
Post your comments here:
Email : (optional)
» Your comments will be displayed only after manual approval.