Difference between revisions of "Assignment 2 (Release 0.3): Q & A"

From CDOT Wiki
Jump to: navigation, search
(Created page with '== Possible Additional Features/Challenging & Interesting Enhancements == === Features Proposed by Team 42 === #Smart word wrapping - Smart wo…')
 
(Q & A)
 
(2 intermediate revisions by one other user not shown)
Line 1: Line 1:
== Possible Additional Features/Challenging & Interesting Enhancements ==
+
== Q & A ==
 +
'''Q:''' How to initialize constant data member variables of class ? <br>
 +
'''A:''' As we know constant things in c++ can only be initialized.They cannot be assigned later. Also in c++ during class declaration we cannot initialize things.so the only way in which we can initialize constant data members of class is by using initialization list.following piece of code will explain it clearly:
 +
<br>
 +
<nowiki>#include <iostream> </nowiki>
 +
<br>
 +
using namespace std;
 +
 
 +
class test
 +
<nowiki>{</nowiki>
 +
<br>
 +
  private:
 +
    const int i;
 +
  public:
 +
      test(int f):i(f)
 +
      {
 +
       
 +
        cout<<"i = "<<i<<endl;
 +
      }   
 +
<nowiki>};</nowiki>
 +
<br>
 +
int main()
 +
{
 +
  const int k =9;
 +
  test t(k);
 +
  return 0; 
 +
}
 +
<br>
 +
'''Submitted by:''' Shajinth Pathmakulaseelan and Auquib Rasul, Team 2 <br><br>
 +
 
 +
'''Q:''' What is the use of this pointer? <br>
 +
'''A:''' this pointer is passed as an implicit argument to member function of class. This pointer contains the address of invoking object i.e the object on which member function is called.this pointer is very useful during operator overloading. <br>
 +
'''Submitted by:''' Shajinth Pathmakulaseelan and Auquib Rasul, Team 2 <br><br>
 +
 
 +
== Bug Reports ==
 +
 
 +
== Possible/Challenging Enhancements ==
  
 
=== Features Proposed by Team 42 ===
 
=== Features Proposed by Team 42 ===
  
#[[:File:Smart_word_wrapping.jpg|Smart word wrapping]] - Smart word wrapping - words are not cut off mid-word while wrapping
+
#Smart word wrapping - words are not cut off mid-word while wrapping
#Optimization - the 'test' compiled .exe has efficiency issues when scrolling around the string
+
#Optimization - "test" compiled executables have efficiency issues when moving boxes around
 
#Colors - you can add color to the test program if you're making your own main
 
#Colors - you can add color to the test program if you're making your own main
 
#Timer - to keep track of how long the user has been running your custom main
 
#Timer - to keep track of how long the user has been running your custom main
 
#Files - Read string from file, use that string for editing, then write the result string to that file, overwriting original
 
#Files - Read string from file, use that string for editing, then write the result string to that file, overwriting original

Latest revision as of 19:01, 11 November 2012

Q & A

Q: How to initialize constant data member variables of class ?
A: As we know constant things in c++ can only be initialized.They cannot be assigned later. Also in c++ during class declaration we cannot initialize things.so the only way in which we can initialize constant data members of class is by using initialization list.following piece of code will explain it clearly:
#include <iostream>
using namespace std;

class test {

 private:
   const int i;
 public:
     test(int f):i(f)
     {
        
        cout<<"i = "<<i<<endl;
     }     

};
int main() {

  const int k =9;
  test t(k);
  return 0;  

}
Submitted by: Shajinth Pathmakulaseelan and Auquib Rasul, Team 2

Q: What is the use of this pointer?
A: this pointer is passed as an implicit argument to member function of class. This pointer contains the address of invoking object i.e the object on which member function is called.this pointer is very useful during operator overloading.
Submitted by: Shajinth Pathmakulaseelan and Auquib Rasul, Team 2

Bug Reports

Possible/Challenging Enhancements

Features Proposed by Team 42

  1. Smart word wrapping - words are not cut off mid-word while wrapping
  2. Optimization - "test" compiled executables have efficiency issues when moving boxes around
  3. Colors - you can add color to the test program if you're making your own main
  4. Timer - to keep track of how long the user has been running your custom main
  5. Files - Read string from file, use that string for editing, then write the result string to that file, overwriting original