.

Friday, March 29, 2019

Features of C++ in programming

Features of C++ in political programingAns1. Unique features of C++ Encapsulation It is the process of combining selective information and services into a whizz unit callight-emitting diode class. Using the method of encapsulation, the programmer shadownot directly access the data rather data is accessible through the mappings present inside the class. It led to the big concept of data hiding.Abstraction It is one of the most sinewy and vital features provided by object-oriented C++ programming language. The main idea do-nothing data abstraction is to give a clear separation amongst properties of datatype and the associated implementation details.Polymorphism It is the ability to use an operator or lead in different ways. Poly, referring to many uses of these operators and functions. A single function example or an operator functioning in many ways sewer be called polymorphism.Inheritance It is the process by which new classes called derived classes are created from be classes called base classes. The derived classes have all the features of the base class and the programmer can choose to add new features specific to the newly created derived classes.C++ soften than CStronger typing the type system in C++ is stronger than in C. This prevents many common programming errors coupled with the next very important feature, the stronger type system even manages not be an inconvenience.A bigger standard library C++ allows the full use of the standard library. It includes the regulation Template Library.Parameterized types the template keyword allows the programmer to write generic implementations of algorithms.Data and methods to thin the data act as one entity i.e. by the usage of classes. constraining scope of data i.e. by using private/public variables.Constructors and destructors for be default behaviour of entities.Ques2. Demonstrate the use of Inline Functions and Function Overloading.Ans2. An Inline function is a function that is expanded in l ine when it is invoked. This kind of function is utilize to save the memory space which becomes appreciable when a function is probably to be called a number of times. It is used to eliminate the cost of calls to delicate functions. Normally, a function call transfers the control from the calling program to the function and after the execution of the program returns the control back to the calling program after the function call but in inline function, when the program is compiled, the enactment present in the function body is replaced in place of the function call.Syntaxinline datatype function_name(arguments)function bodyExampleincludeincludeinline tout mul(float x, float y)return (x*y)inline double div(double p, double q)return (p/q)int main()clrscr()float a= 12.345float b= 9.82cout

No comments:

Post a Comment