Escuela de Ciencias de la Computación
e Informática
Programación II
-
FAQ's: (Frecuent Answered Questions)
-
Which newsgroup
should I post my questions?
-
How do I post
a question about code that doesn't work correctly?
-
How should I handle
resources if my constructors may throw exceptions?
-
What do I do if
I want to update an "invisible" data member inside a "const" member function?
-
Does "const_cast"
mean lost optimization opportunities?
-
How do you use
inheritance in C++, and is that different from Smalltalk?
-
What are the practical
consequences of the differences in Smalltalk/C++ inheritance?
-
Do you need to
learn a "pure" OOPL before you learn C++?
-
What is the NIHCL?
Where can I get it?
-
Where can I get
a copy of "STL"?
-
Nomenclature
and common abbreviations
-
What books are
available for C++?
-
Is C++ backward
compatible with ANSI C?
-
Where can I ftp
a copy of the latest ANSI C++ draft standard?
-
Are there any
C++ standardization efforts underway?
-
Who uses C++?
-
What are some
advantages of C++?
-
What is C++?
What is OOP?
-
What is a class?
-
What is an object?
-
What is a reference?
-
What happens
if you assign to a reference?
-
How can you reseat
a reference to make it refer to a different object?
-
When should I
use references, and when should I use pointers?
-
What are inline
fns? What are their advantages? How are they declared?
-
What is a constructor?
Why would I ever use one?
-
What are destructors
really for? Why would I ever use them?
-
What is operator
overloading?
-
What operators
can/cannot be overloaded?
-
Can I create
a "**' operator for "to-the-power-of' operations?
-
What is a "friend'?
-
Do "friends'
violate encapsulation
-
What are some
advantages/disadvantages of using friends?
-
What does it
mean that "friendship is neither inherited nor transitive'?
-
When would I
use a member function as opposed to a friend function?
-
How can I provide
printing for a "class X'?
-
Why should I
use <iostream.h> instead of the traditional <stdio.h>?
-
Printf/scanf
weren't broken; why "fix' them with ugly shift operators?
-
Does "delete
ptr' delete the ptr or the pointed-to-data?
-
Can I free()
ptrs alloc'd with "new' or "delete' ptrs alloc'd w/ malloc()?
-
Why should I
use "new' instead of trustworthy old malloc()?
-
Why doesn't C++
have a "realloc()' along with "new' and "delete'?
-
How do I allocate
/ unallocate an array of things?
-
What if I forget
the "[]' when "delete'ing array allocated via "new X[n]'?
-
What's the best
way to create a "#define macro_ for _NULL_ in C___
-
How can I handle
a constructor that fails?
-
How can I compile-out
my debugging print statements?
-
What is "const
correctness'?
-
Is "const correctness'
a good goal?
-
Is "const correctness'
tedious?
-
Should I try
to get things const correct "sooner' or "later'?
-
What is a "const
member function'?
-
What is an "inspector'?
What is a "mutator'?
-
What is "casting
away const in an inspector' and why is it legal?
-
But doesn't 'cast
away const' mean lost optimization opportunities?
-
What is inheritance?
-
Ok, ok, but what
is inheritance?
-
How do you express
inheritance in C++?
-
What is "incremental
programming'?
-
Should I pointer-cast
from a derived class to its base class?
-
Derived* -->
Base* works ok; why doesn't Derived** --> Base** work?
-
Does array-of-Derived
is-NOT-a-kind-of array-of-Base mean arrays are bad?
-
What is a "virtual
member function'?
-
What's the big
deal of separating interface from implementation?
-
What is dynamic
dispatch? Static dispatch?
-
Can I override
a non-virtual fn?
-
Can I "revoke'
or "hide' public member fns inherited from my base class?
-
Is a "Circle'
a kind-of an "Ellipse'?
-
Are there other
options to the "Circle is/isnot kind-of Ellipse' dilemma?
-
Why can't I access
"private' things in a base class from a derived class?
-
What's the difference
between "public:', "private:', and "protected:'?
-
How can I protect
subclasses from breaking when I change internal parts?
-
Why does base
ctor get *base*'s virtual fn instead of the derived version?
-
Does a derived
class dtor need to explicitly call the base destructor?
-
How do you express
"private inheritance'?
-
How are "private
derivation' and "containment' similar? dissimilar?
-
Should I pointer-cast
from a "privately' derived class to its base class?
-
Should I pointer-cast
from a "protected' derived class to its base class?
-
What are the
access rules with "private' and "protected' inheritance?
-
Do most C++ programmers
use composition or private inheritance?
-
How do I separate
interface from implementation in C++ (like Modula-2)?
-
What is an ABC
("abstract base class')?
-
What is a "pure
virtual' member function?
-
How can I provide
printing for an entire hierarchy rooted at "class X'?
-
What is a "virtual
destructor'?
-
What is a "virtual
constructor'?
-
What are some
good C++ coding standards?
-
Are coding standards
necessary? sufficient?
-
Should our organization
determine coding standards from our C experience?
-
Should I declare
locals in the middle of a fn or at the top?
-
What source-file-name
convention is best? "foo.C'? "foo.cc'? "foo.cpp'?
-
What header-file-name
convention is best? "foo.H'? "foo.hh'? "foo.hpp'?
-
Are there any
lint-like guidelines for C++?
-
Why does C++'s
FAQ have a section on Smalltalk? Is this Smalltalk-bashing?
-
What's the difference
between C++ and Smalltalk?
-
What is "static
typing', and how is it similar/dissimilar to Smalltalk?
-
Which is a better
fit for C++: "static typing' or "dynamic typing'?
-
How can you tell
if you have a dynamically typed C++ class library?
-
Will "standard
C++' include any dynamic typing primitives?
-
What is value
and/or reference semantics, and which is best in C++?
-
What is "virtual
data', and how-can / why-would I use it in C++?
-
What's the difference
between virtual data and dynamic data?
-
Should class
subobjects be ptrs to freestore allocated objs, or contained?
-
What are relative
costs of the 3 performance hits of allocated subobjects?
-
What is an "inline
virtual member fn'? Are they ever actually "inlined'?
-
Sounds like
I should never use reference semantics, right?
-
Does the poor
performance of ref semantics mean I should pass-by-value?
-
How can I call
a C function "f()' from C++ code?
-
How can I create
a C++ function "f()' that is callable by my C code?
-
Why's the linker
giving errors for C/C++ fns being called from C++/C fns?
-
How can I pass
an object of a C++ class to/from a C function?
-
Can my C function
access data in an object of a C++ class?
-
Why do I feel
like I'm "further from the machine' in C++ as opposed to C?
-
What is the
type of "ptr-to-member-fn'? Is it diffn't from "ptr-to-fn'?
-
How can I ensure
"X's objects are only created with new, not on the stack?
-
How do I pass
a ptr to member fn to a signal handler,X event callback,etc?
-
Why am I having
trouble taking the address of a C++ function?
-
How do I declare
an array of pointers to member functions?
-
How can I insert/access/change
elements from a linked list/hashtable/etc?
-
What's the idea
behind "templates'?
-
What's the syntax
/ semantics for a "function template'?
-
What's the syntax
/ semantics for a "class template'?
-
What is a "parameterized
type'?
-
What is "genericity'?
-
How can I fake
templates if I don't have a compiler that supports them?
-
Why are classes
with static data members getting linker errors?
-
What's the difference
between the keywords struct and class?
-
Why can't I
overload a function by its return type?
-
What is "persistence'?
What is a "persistent object'?
Página
Principal