This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef PRIVATE_FUNCT_H | |
#define PRIVATE_FUNCT_H | |
struct Contact; | |
struct Contact * create_contact(); | |
static void print_numbers( struct Contact * some_contact ); | |
void delete_contact( struct Contact * my_points ); | |
#endif /* PRIVATE_FUNCT_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "private_funct.h" | |
#include <stdio.h> | |
#include <stdlib.h> | |
struct Contact | |
{ | |
int mobile_number; | |
int home_number; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "private_funct.h" | |
int main() | |
{ | |
struct Contact * Tony; | |
Tony = create_contact(); | |
// print_numbers( Tony ); | |
// will cause compile time error | |
delete_contact( Tony ); | |
return 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "private_var.h" | |
#include <stdio.h> | |
int main() | |
{ | |
struct Contact * Tony; | |
Tony = create_contact(); | |
// printf( "Mobile number: %d\n", Tony->mobile_number); | |
// will cause compile time error | |
delete_contact( Tony ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "private_var.h" | |
#include <stdio.h> | |
int main() | |
{ | |
struct Contact * Tony; | |
Tony = create_contact(); | |
int * mobile_number_is_here = (int *)Tony; | |
printf("Mobile number: %d\n", *mobile_number_is_here); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "private_var.h" | |
#include <stdio.h> | |
#include <stdlib.h> | |
struct Contact | |
{ | |
int mobile_number; | |
int home_number; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
class Contact | |
{ | |
private: | |
int mobile_number; // private variable | |
int home_number; // private variable | |
public: | |
Contact() // constructor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
class Contact | |
{ | |
private: | |
int mobile_number; // private variable | |
int home_number; // private variable | |
public: | |
Contact() // constructor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
class Contact | |
{ | |
private: | |
int mobile_number; // private variable | |
int home_number; // private variable | |
public: | |
Contact() // constructor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
class Contact | |
{ | |
private: | |
int mobile_number; // private variable | |
int home_number; // private variable | |
public: | |
Contact() // constructor |