Programing IN C++ : Part 3


Programing IN C++


*      Compare and contrast C and C++.

*      Comparison: C++ is an extension to the C language. When C++ is used as a procedural language, there are only minor syntactical differences between them.

*      Contrast: When used as a procedural language, C++ is a better C because:

*      It vigorously enforces data typing conventions.

*      It allows variables to be defined where they are used.

*      It allows the definition of real (semantically significant) constants.

*      It allows for automatic pointer dereferencing.

*      It supports call-by-reference in addition to call-by-value in functions.

*      It supports tentative variable declarations (when the type and location of a variable cannot be known before hand.

*      As an object oriented language, C++ introduces much of the OOP paradigm while allowing a mixture of OOP and procedural styles.

------------------------------------------------------------------------------------


*      What is operator overloading?

*      It is the process of, and ability to redefine the way an object responds to a C++ operator symbol. This would be done in the object’s class definition.

v---------------------------------------------------------------------------------

*      What is cin and cout?

*      They are objects corresponding to a program’s default input and output files.

---------------------------------------------------------------------------------

*      What are the differences between a C++ struct and C++ class?

*      The default member and base class access specifiers are different.

*      This is one of the commonly misunderstood aspects of C++. Believe it or not, many programmers think that a C++ struct is just like a C struct, while a C++ class has inheritance, access specifiers, member functions, overloaded operators, and so on. Some of them have even written books about C++. Actually, the C++ struct has all the features of the class. The only differences are that a struct defaults to public member access and public base class inheritance, and a class defaults to the private access specifier and private base class inheritance. Getting this question wrong does not necessarily disqualify you because you will be in plenty of good company. Getting it right is a definite plus.


---------------------------------------------------------------------------------

*      What is a default constructor?

*      A constructor that has no arguments or one where all the arguments have default argument values.

*      If you don’t code a default constructor, the compiler provides one if there are no other constructors. If you are going to instantiate an array of objects of the class, the class must have a default constructor.

---------------------------------------------------------------------------------



Anic_an_engineer

Hi, I am Anic an IT Professional . I like to share my knowledge and experience. Thanks for visiting my site.

Please Select Embedded Mode To Show The Comment System.*

أحدث أقدم