Class Member Initialization

Hey guys,

I have a little question: Is there any real difference in the way you initialize class members? Does one create a larger executable or faster run-time?

EX:
.h
1
2
3
4
class foo {
    int a;
    foo(int rhs);
};


.cpp (type 1)
foo::foo(int rhs) : a(rhs) { }

OR

.cpp (type 2)
foo::foo(int rhs) { a = rhs; }
Hi,
(type 1) is generally faster. Use it as often as you like.
Does that help? :)
Yes, thank you. What is the difference between the two in that case though?
http://www.geeksforgeeks.org/when-do-we-use-initializer-list-in-c/
Topic archived. No new replies allowed.