what do you mean by static member variable?
Answers were Sorted based on User's Feedback
In C++ when you declare and define a static variable, it
tells the compiler that only one copy of memory will be
allocated and all the objects of that class will share that
copy.
As we know for class data variables memory will be created
independently for every object of that class. and we can
access the data using object. But, for static variables
memory is created only once for all objects and is no object
is owned the static variable. we can access the static
variable using class name.
Mainly static variables are used when want to count the
objects created and destroyed and when we are dealing with
singleton design pattern.
| Is This Answer Correct ? | 10 Yes | 0 No |
Answer / bhaskar
when static member variable executed that variable value is
automatically assigns to zero....
| Is This Answer Correct ? | 4 Yes | 3 No |
explain sub-type and sub class? atleast u have differ it into 4 points?
What is the diamond problem in inheritance?
what is the abstract class,interface ,its difference with a programatic eg.? hi,recently i went for an interview they ask me what is abstract class ,interface and its difference I said abstract class contain abstact method ,abstract method is a method with no body.Abstract class cannot be instantiated.Abstract class is a base class it required derived class for the implementation of method. Interface is a syntactical contract that all derived class should follow it define properties ,method,events which are known as member of interface. Then They asked me what is the difference between them. I said abstract class interface 1.abstact class can implement method 1.interface cant 2.abstact class can contain constructor, 2.interface cant destructor 3.abstract class cannot support multiple 3.interface support inheritance etc Then they said some different answer I said dont no. Then they ask me when i should make abstract class for an project and when i should make interface. I said if suppose there is two class which must be having method with different logic then we sholud make abstract class. and if suppose we have two class having method .with different logic then we can make interface . Am i correct with my explaination.if not correct me .please provide me that when should we create abstract class and interface and what is difference .please help me
the difference between new and malloc
Write 7 differences between "Public" function and "Private" function?
Explain polymorphism? What r the types of polymorphism? pls give examples?
What is the significance of classes in oop?
What is the correct syntax for inheritance? 1) class aclass : public superclass 2) class aclass inherit superclass 3) class aclass <-superclass
Write a program to sort the number with different sorts in one program ??
What is polymorphism ? Explain with examples
Write a program to demonstrate the use of 'Composition' in C++
What is abstract class in oops?