|
INTERVIEW QUESTIONS
C++
INHERITANCE IN C++
DETAILS
Question: What is a modifier?
Answer: A modifier, also called a modifying function is a member function that changes the value of at least one data member. In other words, an operation that modifies the state of an object. Modifiers are also known as ‘mutators’. Example: The function mod is a modifier in the following code snippet:
class test { int x,y; public: test() { x=0; y=0; } void mod() { x=10; y=15; } };
|
|
|
Category |
Inheritance in C++ Interview Questions & Answers -
Exam Mode /
Learning Mode
|
Rating |
(0.2) By 9640 users |
Added on |
9/19/2014 |
Views |
68098 |
Rate it! |
|
|
Question:
What is a modifier?
Answer:
A modifier, also called a modifying function is a member function that changes the value of at least one data member. In other words, an operation that modifies the state of an object. Modifiers are also known as ‘mutators’. Example: The function mod is a modifier in the following code snippet:
class test { int x,y; public: test() { x=0; y=0; } void mod() { x=10; y=15; } }; Source: CoolInterview.com
A modifier changes the state of an object in a way that is observable to outsiders, ie; it changes the object's abstract state. Ex: class sample{ private: int x,y; public: void assign(int a,int b); { x=a; y=b; } }; Source: CoolInterview.com
Answered by: Monalisha Nayak | Date: 12/17/2009
| Contact Monalisha Nayak
If you have the better answer, then send it to us. We will display your answer after the approval.
Rules to Post Answers in CoolInterview.com:-
- There should not be any Spelling Mistakes.
- There should not be any Gramatical Errors.
- Answers must not contain any bad words.
- Answers should not be the repeat of same answer, already approved.
- Answer should be complete in itself.
|
|
Related Questions |
View Answer |
|
What is the difference between superclass and subclass?
|
View Answer
|
|
If a class is declared without any access modifiers, where may the class be accessed?
|
View Answer
|
|
Does a class inherit the constructors of its superclass?
|
View Answer
|
|
What is an accessor?
|
View Answer
|
|
What is a mutable member?
|
View Answer
|
|
Explain the ISA and HASA class relationships. How would you implement each in a class design?
|
View Answer
|
|
When should you use multiple inheritance?
|
View Answer
|
|
What do you mean by inheritance?
|
View Answer
|
|
Does c++ support multilevel and multiple inheritance?
|
View Answer
|
|
What are the advantages of inheritance?
|
View Answer
|
|
Virtual constructor: Constructors cannot be virtual. Declaring a constructor as a virtual function is a syntax error. Does c++ support multilevel and multiple inheritance?
|
View Answer
|
|
Can we include music/song in background while running a program like a game in c++ ?
|
View Answer
|
|
What does inheritance means in C++? What are the different forms of inheritance? Give an example for each.
|
View Answer
|
|
what are the advantages and disadvantages of inheritance?
|
View Answer
|
|
Why Call by reference technique is used in case of Copy constructor & not call by value?
|
View Answer
|
|
What is the difference between composition and inheritance?
|
View Answer
|
|
What Is The Use of VirtualDestructer?
|
View Answer
|
|
Is there any way to write a class such that no class can be inherited from it. Please include code
|
View Answer
|
|
What do you mean by inheritance?
|
View Answer
|
|
class A() { };
int main() { A a; }
Whether there will be a default constructor provided by the compiler in above case ?
|
View Answer
|