Friday, March 10, 2023
HomeGolangExactly how to bypass approaches in Youngster, however called Moms and dad?...

Exactly how to bypass approaches in Youngster, however called Moms and dad? – Obtaining Assistance


 kind A struct {
}

func NewA() * {A return && {A}

} func( a * A) Foo() {fmt.Println(" Foo of A").

} func( a * A) Bar() {// Even more codes ...
a.Foo().

// Even more codes ...}
kind B struct {* A.}
func NewB() * B {
return & B {
A: NewA(),.
}

} func( b * B)
Foo () {

fmt.Println(" Foo of B"
).
}
func major () {b:= NewB() b.Bar ().} 

I intend to bypass the Foo()(* )technique in B , as well as allow B(* )acquire all points A has When calling b.Bar()
, I believe it must publish: Foo of B. Yet it does not.(* )In Java, it functions similar to this:



public course Key {course {A public space foo() {

System.out.println(" Foo of A");.

}

public space bar() {
foo();.
}}
course B expands {A public space foo() {
System.out.println( "Foo of B");.
}

} public space Test01() {
B b = brand-new B();.
b.bar();.
}
public fixed space major( String 

args) {
Key m = brand-new Key ();. m.Test01 ();.}}

.

RELATED ARTICLES

Most Popular

Recent Comments