Why static functions always uses static variables?
Answers were Sorted based on User's Feedback
Answer / george from psg
static function is constant to all object. In the same way
static variable is constant to all so we use static variable
in static function
Is This Answer Correct ? | 9 Yes | 1 No |
Answer / som shekhar
If you take in the context of the class, static member
functions cannot be called by the ordinary objects because
when normal object calls the function then address of the
object is passed is collected by "this" pointer and static
member function don't have "this" pointer.
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / harsha
context,object are created in RAM. context is created
once.static methods implementaion , static varibles loads
into context only once.All those staic members avilable to
each other obviously.
Is This Answer Correct ? | 2 Yes | 3 No |
What is polymorphism ? Explain with examples
what is different between oops and c++
Why can't we have instance(stack) of a class as a member of the same class like eg.Class A{A obj;} as we can have self refential pointer
pointers are support in C#? if yes then how to use it?
8 Answers Softvision Solution,
Why static Function is used in C++?
How does polymorphism work?
What is the difference between abstraction and polymorphism?
What are the fields of vtable
Write a program to find out the number of palindromes in a sentence.
what is SPL in c++.
1.explicit call for destructor 2.calling function inside a constructor. 3.base *b-new derived delete b; 4.delete p what it will delete. 5.size of base class and derived class int i,in base class and int j in derived. 6.int i-20 int main() { int i =5; printf("%d".::i); { int i =10; printf("%d".::i); } } 7.object slicing 8.new 9.function overloading(return type). 10.class base() { virtuval fun() { ----- } } class derivied:public base() { fun() { ----- } } int main() { derived d; } 11.how static function will call in C++? 12.default structures are in C++? 13.constructors should be in public . 14.virtuval constructor not exist. 15.multilevel inhritence. destructor order.
• What are the desirable attributes for memory managment?