Skip to content

Commit 59ce6c4

Browse files
committed
.
1 parent 80df28f commit 59ce6c4

File tree

2 files changed

+33
-1
lines changed

2 files changed

+33
-1
lines changed

59-AmbiguityResolution.cpp

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
//59-AmbiguityResolution
2+
3+
#include <iostream>
4+
5+
class A{
6+
public:
7+
void f(){
8+
std::cout << "Hello from A." << std::endl;
9+
}
10+
};
11+
12+
class B{
13+
public:
14+
void f(){
15+
std::cout << "Hello from B." << std::endl;
16+
}
17+
};
18+
19+
class C: public A, public B{
20+
public:
21+
void f(){
22+
A::f();
23+
B::f();
24+
}
25+
};
26+
27+
int main(){
28+
C c;
29+
c.f();
30+
}

MODERNCPP_REMINDER.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@
6161
* LValue: expression that refers to object. something that can be on left-hand side of assignment. lvalue(i&!m) glvalue
6262
* Memory Model: defines semantics of computer memory storage for purpose of abstract machine.
6363
* Module: help divide large amounts of code into logical parts.
64-
* Movable: program allowed to move object value to another location and leave this object in valid but unspecified state. (m)
64+
* Movable: program allowed to move object value to another location and leave this object in valid but unspecified state. (m)
65+
* Multiple Inheritance: deriving directly from more than one class.
6566
* Name: denotes entity is introduced into program by declaration. identifier, overloaded operator, user defined conversion function, user defined literal, template name.
6667
* Name Lookup: procedure by which name, when encountered in a program, is associated with declaration that introduced it.
6768
* Named Constructor: provide public static methods that return object.
@@ -533,6 +534,7 @@
533534
* virtual member function means declaration must stay same in derived classes, but the definition can be overridden.
534535
* unless compelling reasons are given to contrary, member objects should be by value and parameters should be by reference.
535536
* it is typically bad idea to call virtual function from constructor or destructor.
537+
* interface virtual destructor ensures proper cleanup of data that will be defined in derived classes.
536538

537539
* Nifty Counter Idiom:
538540
* Return Value Optimization:

0 commit comments

Comments
 (0)