User Profile

Collapse

Profile Sidebar

Collapse
subi09
subi09
Last Activity: Feb 14 '13, 08:32 AM
Joined: Nov 16 '12
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • subi09
    started a topic Explicit Template Argument Specification
    in C

    Explicit Template Argument Specification

    i started reading about templates and i got confused on the below.
    Code:
    template<class T>
    T max(T t1, T t2)
    {
       if (t1 > t2)
          return t1;
       return t2;
    }

    int main(){

    std::cout<<max< int>120,14.55);//=>as per my understanding here if i explicitly mention only one data type,other would be deducted from the argument type(14.55) by the compiler.That...
    See more | Go to post

  • Thanks for the quick reply.Do you meant remote debugging??if we ssh to a remote machine with command as 'gdb',how will i invoke a process in my target machine. iam not sure about that yar.I searched in net and tried below steps in my environment.But i couldnt connect.Below are the steps i did

    Suppose A is machine which has VM ware OS insatlled with ip address (x.y.z.w) and B a linux machine with ip (b.c.d.e )having gdb installed in...
    See more | Go to post
    Last edited by subi09; Nov 23 '12, 05:06 AM. Reason: clarification

    Leave a comment:


  • subi09
    started a topic Is it possible to install gdb in vmware-MN OS?

    Is it possible to install gdb in vmware-MN OS?

    Is it possible to install gdb in vmware-MN OS?if not possible then how to debug a code in vmware platform.Kindly reply
    See more | Go to post

  • Then if am adding 2 piece of code extra to the above like below

    Code:
    #include<iostream>
    using namespace std;
    class Cents
    {
    
    public:
    int m_nCents;
    Cents(int nCents=0):m_nCents(nCents)
    {
    cout<<"Calling normal constructor with value:"; m_nCents = nCents;
    cout<<m_nCents<<endl;
    }
    
    // Copy constructor
    Cents(const
    ...
    See more | Go to post
    Last edited by Rabbit; Nov 20 '12, 05:59 PM. Reason: Please use code tags when posting code.

    Leave a comment:


  • Thanks for the reply .But as per my understanding,

    Cents obj2 = 37;=> statement will create a temporary object of Cents and initialise it with 37(that is where constructor is called) and then it will copy the value of that object to obj2(at this time copy constructor should be called).



    Please clarify this and correct me if am wrong.
    See more | Go to post

    Leave a comment:


  • Why overloaded copy constructor is not getting called here?

    Code:
    #include<iostream>
    using namespace std;
    class Cents
    {
    
    public:
      int m_nCents;
       Cents(int nCents=0):m_nCents(nCents)
        {
           cout<<"Calling normal constructor with value:";   m_nCents = nCents;
           cout<<m_nCents<<endl;
        }
    
        // Copy constructor
        Cents(const Cents& cSource)
        {
            cout<<"Calling
    ...
    See more | Go to post
    Last edited by Meetee; Nov 19 '12, 01:21 PM. Reason: please add code tags <code/> around your code
No activity results to display
Show More
Working...