- What are instance variables?
These represent an object's private memory. They are defined in an object's class.
- What are class variables?
These represent a class's memory which it shares with each of its instances.
- What is a method?
A method is a class's procedural response to a given message protocol. It is like the definition of a procedure in other languages.
- In C++ what is a constructor? A destructor?
A constructors and destructors are methods defined in a class that are invoked automatically when an object is created or destroyed. They are used to initialize a newly allocated object and to cleanup behind an object about to be removed.
- Compare and contrast C and C++.
Comparison: C++ is an extension to the C language. When C++ is used as a procedural language, there are only minor syntactical differences between them.
Contrast: When used as a procedural language, C++ is a better C because:
- It vigorously enforces data typing conventions.
- It allows variables to be defined where they are used.
- It allows the definition of real (semantically significant) constants.
- It allows for automatic pointer dereferencing.
- It supports call-by-reference in addition to call-by-value in functions.
- It supports tentative variable declarations (when the type and location of a variable cannot be known before hand.
- What is operator overloading?
It is the process of, and ability to redefine the way an object responds to a C++ operator symbol. This would be done in the object's class definition.
- What is cin and cout?
They are objects corresponding to a program's default input and output files.
Thursday, 26 May 2011
C++ program part2
Labels:
C++,
Interview question
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment