Start Discovering Solved Questions and Your Course Assignments
TextBooks Included
Active Tutors
Asked Questions
Answered Questions
the voltage at the terminals of a battery is 52v when no load is linked and 488v when a load taking 80a is connected find the internal resistance of
class templatesin addition to function templates c also supports the method of class templates by definition a class template is a class
how to write a function templatea function template should be written at the beginning of the program in the global area or you may place it into a
consider the following exampleint maxint x int y
function templatesfunction templates give you with the capability to write a one function that is a skeleton or template for a family of similar
changing field widththe printf and scanf functions from the standard library use width specifier for controlling the width of its output similarly
manipulatorsthere are several classes in the iostreamh header file one of them is ios class this class stores the format state for example some bits
input outputmost languages have statements to perform io though in c and c we use functions to perform io c also has its own io mechanism - the cin
the undef directivethis directive undefines a previously explained macro for example the following will give an error since pi is
the define directivethe define directive explains a macro which is a text string represented by a name whenever the pre-processor finds this name in
the preprocessor directivesa preprocessor directive which starts with a hash is an instruction to the preprocessor which acts on the source code
how to write an inline class member functionin addition to global functions you may request that non-static member functions of a class be
here is a program that uses an inline function to compute and return the absolute value of its input argument include ltstdiohgtinline int absint
how to write a global inline functionfirst lets get away from member functions for a moment and consider a global function to make a request that
inline functionsimagine a c program which reads disk records having employee information if this is a payroll application each employee record data
friend for overloading operatorssometimes friend functions cannot be avoided for example with the operator overloading consider the following class
using a friendusing a friend function is quite easy the following example explains a friend function to access members of two classesclass
friend functionsone of the major features of oop is information hiding a class encapsulates data and methods to operate on that data in a single unit
static member functionsall the objects of the class share static data members of a class the example above demonstrates how to keep track of all the
static class membersas we already know all the objects of the class have dissimilar data members but invoke the similar member functions though there
write a program of constructors and destructorsmake a class drugs having encapsulated data for medicine name whether solid or liquid price and
pure virtual functionsan abstract class is one which is used just for deriving some other classes no object of this class is declared and used in the
virtual functionsthe keyword virtual was previously used to resolve ambiguity for a class derived from two classes both having a common ancestor
abstract classesabstract classes are the classes which are written just to act as base classes consider the following
virtual base classesthis ambiguity can be resolved if the class derived have only one copy of the class base this can be done by making the base