Default Class Operators

This is a discussion on Default Class Operators within the C++ Programming forums, part of the General Programming Boards category; hi Guys, eventhough i've been using c++ for a while now. i have a basic question about operators ("=", "+"...etc) ...

  1. #1
    Registered User symbiote3's Avatar
    Join Date
    Jul 2007
    Posts
    5

    Question Default Class Operators

    hi Guys,

    eventhough i've been using c++ for a while now. i have a basic question about operators ("=", "+"...etc) used on classes. i'll give an example:

    Code:
    class A
    {...}
    
    A a1 ;
    A a2 ;
    
    a1 = a2 ;
    what is going to happen to a1? can i find information anywhere on the internet about the default operators for classes?

    Greetings

  2. #2
    The larch
    Join Date
    May 2006
    Posts
    3,573
    After than a1 will be a memberwise copy of a2. Unless you have overloaded operator= to something differently (for example, a deep copy).
    I might be wrong.

    Thank you, anon. You sure know how to recognize different types of trees from quite a long way away.
    Quoted more than 1000 times (I hope).

  3. #3
    Registered User symbiote3's Avatar
    Join Date
    Jul 2007
    Posts
    5
    alright
    thanks for clearing that up

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Help with FIFO QUEUE
    By jackfraust in forum C++ Programming
    Replies: 23
    Last Post: 04-03-2009, 08:17 AM
  2. Class operators when inheriting
    By 39ster in forum C++ Programming
    Replies: 5
    Last Post: 07-14-2008, 06:13 AM
  3. template class default constructor problem
    By kocika73 in forum C++ Programming
    Replies: 3
    Last Post: 04-22-2006, 09:42 PM
  4. structure vs class
    By sana in forum C++ Programming
    Replies: 13
    Last Post: 12-02-2002, 06:18 AM
  5. Abstract class problem
    By VanJay011379 in forum C++ Programming
    Replies: 9
    Last Post: 07-31-2002, 01:30 PM

Tags for this Thread


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21